This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // draft / create simple project | |
| public class WcfClientService<TProxy> | |
| { | |
| private static ChannelFactory<TProxy> channelFactory = new ChannelFactory<TProxy>("*"); | |
| public static TResult GetData<TResult>(Func<TProxy, TResult> codeBlock) | |
| { | |
| channelFactory.Endpoint.EnableChannelFactoryLog(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // draft | |
| // required amplify | |
| // required knockout | |
| (function(ko) { | |
| // for observableArray() | |
| ko.extenders.localArrayStore = function(target, key) { | |
| var value = amplify.store(key) || target(); | |
| //track the changes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) | |
| { | |
| // this method call for each element on page | |
| var webBrowser = sender as WebBrowser; | |
| if (webBrowser != null && e.Url.AbsolutePath != webBrowser.Url.AbsolutePath) | |
| return; // not ready | |
| // ready! | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using mshtml; | |
| // C# 6+ | |
| public static void WebBrowserFindSelectAndScroll(WebBrowser webBrowser, string searchString) | |
| { | |
| // you can add check page load complette, if needed | |
| IHTMLDocument2 document = webBrowser.Document?.DomDocument as IHTMLDocument2; | |
| IHTMLTxtRange range = document?.selection.createRange() as IHTMLTxtRange; | |
| if (range == null) return; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static class HtmlRemoval | |
| { | |
| static readonly Regex TagsRegex = new Regex("<.*?>", RegexOptions.Compiled); | |
| static readonly Regex ElementsRegex = new Regex("&.*?;", RegexOptions.Compiled); | |
| /// <summary> | |
| /// Remove <p> <br> ect | |
| /// </summary> | |
| /// <param name="source"></param> | |
| /// <returns></returns> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void OpenFileInWord(string wordFile, string searchText = null) | |
| { | |
| Application wordObject = GetWordApplication(); | |
| object file = wordFile; | |
| Document thisDoc = wordObject.Documents.Open(ref file); | |
| if (!string.IsNullOrEmpty(searchText)) | |
| { | |
| // find, select and scroll |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // jquery inputmask with knockoutjs | |
| // mask always appiled like "+7 999 123 45 67" | |
| // but submited unmasked value "9991234567" | |
| ko.bindingHandlers.masked = { | |
| init: function (element, valueAccessor, allBindingsAccessor) { | |
| var mask = allBindingsAccessor().mask || {}; | |
| $(element).inputmask({ "mask": mask, 'autoUnmask': false }); | |
| ko.utils.registerEventHandler(element, 'focusout', function () { | |
| var value = $(element).inputmask('unmaskedvalue'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="UTF-8"?> | |
| <schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://bunkovdenis.com" | |
| targetNamespace="http://bunkovdenis.com" elementFormDefault="qualified"> | |
| <element name="РеестрДокументов" > | |
| <complexType> | |
| <sequence maxOccurs="unbounded"> | |
| <element ref="tns:Документ"/> | |
| </sequence> | |
| <attribute name="НомерРеестра" type="string" use="optional"/> | |
| <attribute name="ДатаРеестра" type="date" use="optional"/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Expression<Func<Operations, bool>> coverLimit = o => o.Discriminator == "CoverLimitOperation"; | |
| Expression<Func<Operations, bool>> financing = o => o.Discriminator == "FinancingOperation"; | |
| Deliveries.AsExpandable() | |
| .Where(x => x.DeliveryOperations.Where(coverLimit.Compile()).Any(t => t.Value > 0)) | |
| .Where(x => !x.DeliveryOperations.Any(financing.Compile())) | |
| .Dump(); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT | |
| [Extent1].[EmailLogId] AS [EmailLogId], | |
| [Extent1].[SentDate] AS [SentDate], | |
| [Extent1].[Email] AS [Email], | |
| [Extent1].[Name] AS [Name], | |
| [Extent1].[Subject] AS [Subject], | |
| [Extent1].[Body] AS [Body], | |
| [Extent1].[ErrorMessage] AS [ErrorMessage] | |
| FROM [dbo].[EmailLogs] AS [Extent1] | |
| WHERE (N'my@company.com' = [Extent1].[Email]) AND ([Extent1].[Email] IS NOT NULL) |
NewerOlder