/// <summary Get Collection> /// Get collection of emails. If no records to return, EmailCollection will be null. /// </summary> /// <returns></returns> public static AddressCollection GetCollection(int employeeId) { AddressCollection tempList = null; using (SqlConnection myConnection = new SqlConnection(AppConfiguration.ConnectionString)) { using (SqlCommand myCommand = new SqlCommand("usp_GetAddress", myConnection)) { myCommand.CommandType = CommandType.StoredProcedure; myCommand.Parameters.AddWithValue("@QueryId", SelectTypeEnum.GetCollection); myCommand.Parameters.AddWithValue("@EmployeeId", employeeId); myConnection.Open(); using (SqlDataReader myReader = myCommand.ExecuteReader()) { if (myReader.HasRows) { tempList = new AddressCollection(); while (myReader.Read()) { tempList.Add(FillDataRecord(myReader)); } } myReader.Close(); } } } return tempList; }
public void Initialize(AddressCollection addresses, BusinessEntity business) { this.addresses = addresses; this.business = business; grid.Columns[1].Visible = true; }
private IAddressGroup ReadAddressGroup(XmlNodeList addressCollectionIdNode, IAddressGroup entireAddressGroup, bool routingTableReadOnly) { bool addressCollectionsReadOnly = false; if (addressCollectionIdNode.Count > 0) { XmlNode node = addressCollectionIdNode[0].ParentNode; addressCollectionsReadOnly = PolicyUtilities.IsReadOnly(node); } IAddressGroup addressGroup = new AddressGroup(Guid.Empty, "", routingTableReadOnly || addressCollectionsReadOnly); List<string> exclusions = new List<string>(); exclusions.Add("id"); exclusions.Add("readonly"); foreach (XmlNode addressIdNode in addressCollectionIdNode) { string addressId = addressIdNode.Attributes.GetNamedItem("id").InnerText; bool readOnly = PolicyUtilities.IsReadOnly(addressIdNode); AddressCollection currentCollection = entireAddressGroup[new Guid(addressId)] as AddressCollection; if (currentCollection != null) { AddressCollection copiedCollection = new AddressCollection(currentCollection, readOnly); new XmlCustomAttributesReader(copiedCollection, addressIdNode.Attributes, exclusions).Read(); addressGroup.Add(copiedCollection); } } return addressGroup; }
public void SaveMailContacts(int tenant, string user, Message message) { try { Func <AddressCollection, AddressCollection> copyAddressesFunc = delegate(AddressCollection addresses) { var newAddresses = new AddressCollection(); foreach (var address in addresses) { newAddresses.Add(new Address(address.Email, !string.IsNullOrEmpty(address.Name) ? Codec.RFC2047Decode(address.Name) : string.Empty)); } return(newAddresses); }; var contacts = new AddressCollection(); contacts.AddRange(copyAddressesFunc(message.To)); contacts.AddRange(copyAddressesFunc(message.Cc)); contacts.AddRange(copyAddressesFunc(message.Bcc)); var contactsList = contacts.Distinct().ToList(); using (var db = GetDb()) { var validContacts = (from contact in contactsList where MailContactExists(db, tenant, user, contact.Name, contact.Email) < 1 select contact).ToList(); if (!validContacts.Any()) { return; } var lastModified = DateTime.UtcNow; var insertQuery = new SqlInsert(ContactsTable.name) .InColumns(ContactsTable.Columns.id_user, ContactsTable.Columns.id_tenant, ContactsTable.Columns.name, ContactsTable.Columns.address, ContactsTable.Columns.last_modified); validContacts .ForEach(contact => insertQuery .Values(user, tenant, contact.Name, contact.Email, lastModified)); db.ExecuteNonQuery(insertQuery); } } catch (Exception e) { _log.Error("SaveMailContacts(tenant={0}, userId='{1}', mail_id={2}) Exception:\r\n{3}\r\n", tenant, user, message.Id, e.ToString()); } }
public void Reload() { Addresses = new AddressCollection(Wallet.Addresses.ToList()); if (TableView != null) { TableView.ReloadData(); } }
public void Start(AppFunc appFunc, string url) { var addressCollection = new AddressCollection(new List <IDictionary <string, object> >()) { new Address("http", "localhost", "1083", "/") }; Start(appFunc, addressCollection.List); }
private AddressCollection MimeMessageToAddessCollectionGet(MimeMessage message) { var result = new AddressCollection(); foreach (var rawAddress in _testContext.MimeMessageToAddresses) { result.Add(new Address(rawAddress)); } return(result); }
/// <summary> /// Loads the addresses. /// </summary> /// <param name="addressType">Type of the address.</param> /// <returns></returns> private AddressCollection LoadAddresses(AddressType addressType) { List <Address> addressList = _user.AddressCollection.FindAll(delegate(Address address) { return(address.AddressType == addressType); }); AddressCollection addressCollection = new AddressCollection(); addressCollection.AddRange(addressList); return(addressCollection); }
private void BindData() { Customer customer = CustomerManager.GetCustomerById(this.CustomerId); if (customer != null) { AddressCollection billingAddressCollection = customer.BillingAddresses; dlBillingAddresses.DataSource = billingAddressCollection; dlBillingAddresses.DataBind(); } }
public void TestRetrieveAll() { AddressCollection addressCollection = Address.All(); Assert.IsNotNull(addressCollection); foreach (var address in addressCollection.addresses) { Assert.IsNotNull(address.id); Assert.AreEqual(address.id.Substring(0, 4), "adr_"); } }
private void BindData() { Customer customer = CustomerManager.GetCustomerByID(this.CustomerID); if (customer != null) { AddressCollection shippingAddressCollection = customer.ShippingAddresses; dlShippingAddresses.DataSource = shippingAddressCollection; dlShippingAddresses.DataBind(); } }
public ConstituentInfo(DataSet tessResults) { DataTableCollection tables = tessResults.Tables; if (tables.Contains("Addresses") && tables["Addresses"].Rows.Count > 0) { Addresses = new AddressCollection(tables["Addresses"]); } if (tables.Contains("ConstituentAttribute") && tables["ConstituentAttribute"].Rows.Count > 0) { Attributes = new ConstituentAttributeCollection(tables["ConstituentAttribute"]); } if (tables.Contains("EmailAddresses") && tables["EmailAddresses"].Rows.Count > 0) { EmailAddresses = new EmailAddressCollection(tables["EmailAddresses"]); } if (tables.Contains("Associations") && tables["Associations"].Rows.Count > 0) { Associations = new AssociationCollection(tables["Associations"]); } if (tables.Contains("Constituency") && tables["Constituency"].Rows.Count > 0) { Constituencies = new ConstituencyCollection(tables["Constituency"]); } if (tables.Contains("ConstituentHeader") && tables["ConstituentHeader"].Rows.Count > 0) { Header = new ConstituentHeader(tables["ConstituentHeader"]); } if (tables.Contains("Contribution") && tables["Contribution"].Rows.Count > 0) { Contributions = new ContributionRecordCollection(tables["Contribution"]); } if (tables.Contains("Interests") && tables["Interests"].Rows.Count > 0) { Interests = new InterestCollection(tables["Interests"]); } if (tables.Contains("Memberships") && tables["Memberships"].Rows.Count > 0) { Memberships = new MembershipCollection(tables["Memberships"]); } if (tables.Contains("Phones") && tables["Phones"].Rows.Count > 0) { PhoneNumbers = new PhoneNumberCollection(tables["Phones"]); } if (tables.Contains("ProgramListings") && tables["ProgramListings"].Rows.Count > 0) { ProgramListings = new ProgramListingCollection(tables["ProgramListings"]); } if (tables.Contains("Rankings") && tables["Rankings"].Rows.Count > 0) { Rankings = new RankCollection(tables["Rankings"]); } }
private void BindAddresses() { AddressCollection billingAddresses = NopContext.Current.User.BillingAddresses; rptrBillingAddresses.DataSource = billingAddresses; rptrBillingAddresses.DataBind(); AddressCollection shippingAddresses = NopContext.Current.User.ShippingAddresses; rptrShippingAddresses.DataSource = shippingAddresses; rptrShippingAddresses.DataBind(); }
public void InsertAndRemove() { Assert.DoesNotThrow(delegate { Address address = new Address(); AddressCollection addressCollection = new AddressCollection(); addressCollection.Add(address); address = addressCollection[0]; addressCollection[0] = address; addressCollection.Remove(address); }); }
private static void SetMailRecipients(AddressCollection recipients, String subject, AddressCollection CC, AddressCollection BCC, SmtpMessage newMail) { //=?ISO-8859-1?B?0fHR8dHx0fG0tLS0b/PztLRv8w==?= String encodedSubject = "=?ISO-8859-1?B?"; Encoding iso = Encoding.GetEncoding("ISO-8859-1"); encodedSubject += Convert.ToBase64String(iso.GetBytes(subject), Base64FormattingOptions.InsertLineBreaks); encodedSubject += "?="; newMail.Subject = encodedSubject; newMail.To = recipients; newMail.Cc = CC ?? new AddressCollection(); newMail.Bcc = BCC ?? new AddressCollection(); }
public void ViewAccessibilityAddressCollectionConstructor() { tlog.Debug(tag, $"ViewAccessibilityAddressCollectionConstructor START"); using (View view = new ImageView()) { var testingTarget = new AddressCollection(Interop.ControlDevel.DaliToolkitDevelControlNewGetAccessibilityRelations(view.SwigCPtr)); Assert.IsNotNull(testingTarget, "Can't create success object AddressCollection"); Assert.IsInstanceOf <AddressCollection>(testingTarget, "Should be an instance of AddressCollection type."); } tlog.Debug(tag, $"ViewAccessibilityAddressCollectionConstructor END (OK)"); }
private void _bFilterEmails_Click(object sender, EventArgs e) { // We instantiate the pop3 client. Pop3Client pop = new Pop3Client(); try { this.AddLogEntry(string.Format("Connection to the pop 3 server : {0}", _tbPop3Server.Text)); // Connect to the pop3 client pop.Connect(_tbPop3Server.Text, _tbUserName.Text, _tbPassword.Text); AddressCollection ac; HeaderCollection hc = new HeaderCollection(); //Retrive a message headers for (int n = 1; n < pop.MessageCount + 1; n++) { Header h = pop.RetrieveHeaderObject(n); ac = new AddressCollection(); ac.Add(h.From); ac = Validator.Filter(ac); //If address is not filtered if (ac.Count > 0) { hc.Add(h); } } this.AddLogEntry(string.Format(" {0} messages passed the filter", hc.Count.ToString())); } catch (Pop3Exception pexp) { this.AddLogEntry(string.Format("Pop3 Error: {0}", pexp.Message)); } catch (Exception ex) { this.AddLogEntry(string.Format("Failed: {0}", ex.Message)); } finally { if (pop.IsConnected) { pop.Disconnect(); } } }
/// <summary> /// Loads the addresses. /// </summary> private void LoadAddresses() { AddressCollection billingAddresses = LoadAddresses(AddressType.BillingAddress); rptrBillingAddresses.DataSource = billingAddresses; rptrBillingAddresses.ItemDataBound += new RepeaterItemEventHandler(rptrBillingAddresses_ItemDataBound); rptrBillingAddresses.DataBind(); AddressCollection shippingAddresses = LoadAddresses(AddressType.ShippingAddress); rptrShippingAddresses.DataSource = shippingAddresses; rptrShippingAddresses.ItemDataBound += new RepeaterItemEventHandler(rptrShippingAddresses_ItemDataBound); rptrShippingAddresses.DataBind(); }
public void InsertAndRemoveNonExistentIndices() { AddressCollection addressCollection = new AddressCollection(); Assert.Throws <IndexOutOfRangeException>(delegate { var address_ = addressCollection[0]; }); var address = new Address(); Assert.Throws <IndexOutOfRangeException>(delegate { addressCollection[0] = address; }); }
private String GetAddressNameAndMail(AddressCollection addresses) { String addressesNamesAndMail = ""; if (addresses.Count == 0) { return(addressesNamesAndMail); } for (int currentAddress = 0; currentAddress < addresses.Count; currentAddress++) { addressesNamesAndMail += addresses[currentAddress].Merged + ", "; } addressesNamesAndMail.Remove(addressesNamesAndMail.Length - 2); return(addressesNamesAndMail); }
public static AddressCollection ParseAddresses(String toAddresses) { /*[email protected], "Simpson Marge" <*****@*****.**>, * "Simpson Bart" <*****@*****.**>, , "Simpson Bart" <*****@*****.**>, * "Simpson Maggie" <*****@*****.**>, */ String recipientName, line; String[] inlineRecipients; ActiveUp.Net.Mail.AddressCollection addresses = new AddressCollection(); toAddresses = toAddresses.Replace("<", String.Empty); toAddresses = toAddresses.Replace(">", String.Empty); String[] recipients = toAddresses.Split(new String[] { ",", ";" }, StringSplitOptions.RemoveEmptyEntries); foreach (String recipientLine in recipients) { line = recipientLine; if (recipientLine.Contains("\"")) { recipientName = recipientLine.Substring(recipientLine.IndexOf("\"") + 1, recipientLine.LastIndexOf("\"") - recipientLine.IndexOf("\"") - 1); line = recipientLine.Remove(0, recipientLine.LastIndexOf("\"") + 1); } else { recipientName = ""; } line = System.Text.RegularExpressions.Regex.Replace(line, @"\s+", " "); inlineRecipients = line.Split(new String[] { " " }, StringSplitOptions.RemoveEmptyEntries); for (Int16 currentInlineRecipient = 0; currentInlineRecipient < inlineRecipients.Length; currentInlineRecipient++) { if (inlineRecipients[currentInlineRecipient] == " " || inlineRecipients[currentInlineRecipient] == "\"" || inlineRecipients[currentInlineRecipient] == ":") { continue; } if (currentInlineRecipient == 0 && recipientName != "") { addresses.Add(new ActiveUp.Net.Mail.Address(inlineRecipients[currentInlineRecipient], recipientName)); } else { addresses.Add(new ActiveUp.Net.Mail.Address(inlineRecipients[currentInlineRecipient])); } } } return(addresses); }
public void SaveMailContacts(int tenant, string user, Message message) { try { var contacts = new AddressCollection(); contacts.AddRange(message.To); contacts.AddRange(message.Cc); contacts.AddRange(message.Bcc); foreach (var contact in contacts) { contact.Name = !String.IsNullOrEmpty(contact.Name) ? Codec.RFC2047Decode(contact.Name) : String.Empty; } var contactsList = contacts.Distinct().ToList(); using (var db = GetDb()) { var validContacts = (from contact in contactsList where MailContactExists(db, tenant, user, contact.Name, contact.Email) < 1 select contact).ToList(); if (!validContacts.Any()) return; var lastModified = DateTime.UtcNow; var insertQuery = new SqlInsert(ContactsTable.name) .InColumns(ContactsTable.Columns.id_user, ContactsTable.Columns.id_tenant, ContactsTable.Columns.name, ContactsTable.Columns.address, ContactsTable.Columns.last_modified); validContacts .ForEach(contact => insertQuery .Values(user, tenant, contact.Name, contact.Email, lastModified)); db.ExecuteNonQuery(insertQuery); } } catch (Exception e) { _log.Error("SaveMailContacts(tenant={0}, userId='{1}', mail_id={2}) Exception:\r\n{3}\r\n", tenant, user, message.Id, e.ToString()); } }
public void Enviar() { ServerCollection servers = new ServerCollection(); Server Nlayer = new Server(); Message message = new Message(); MimeBody mimeBody = new MimeBody(BodyFormat.Html); AddressCollection destinos = new AddressCollection(); Nlayer.Host = "mail.softwareNlayer.com"; Nlayer.Password = "******"; Nlayer.Port = 25; Nlayer.Username = "******"; servers.Add(Nlayer); if (_destinos != null) { foreach (string destino in _destinos) { destinos.Add(new Address(destino)); } } if (_adjuntos != null) { foreach (string adjunto in _adjuntos) { message.Attachments.Add(adjunto, false); } } mimeBody.Text = _mensaje; message.BodyHtml = mimeBody; message.Date = DateTime.Now; message.From = new Address("*****@*****.**"); message.Organization = "Nlayer Software"; message.Priority = MessagePriority.Normal; message.To = destinos; message.Subject = _asunto; AsyncCallback beginCallback = IniciaEnvio; SmtpClient.BeginSend(message, servers, beginCallback); }
private IDisposable CreateListener(int port) { var appProperties = new AppProperties(new Dictionary <string, object>()) { Addresses = AddressCollection.Create() }; var address = Address.Create(); address.Scheme = "http"; address.Host = "localhost"; address.Port = port.ToString(); address.Path = "/sonarlint/api/"; appProperties.Addresses.Add(address); // Create a new Owin HTTPListener that forwards all requests to our processor for handling. return(OwinServerFactory.Create(requestProcessor.ProcessRequest, appProperties.Dictionary)); }
protected void Page_Load(object sender, EventArgs e) { if ((NopContext.Current.User == null) || (NopContext.Current.User.IsGuest && !CustomerManager.AnonymousCheckoutAllowed)) { string loginURL = CommonHelper.GetLoginPageURL(true); Response.Redirect(loginURL); } Cart = ShoppingCartManager.GetCurrentShoppingCart(ShoppingCartTypeEnum.ShoppingCart); IndividualOrderCollection indOrders = IndividualOrderManager.GetCurrentUserIndividualOrders(); if (Cart.Count == 0 && indOrders.Count == 0) { Response.Redirect("~/ShoppingCart.aspx"); } if (!Page.IsPostBack) { CustomerManager.ResetCheckoutData(NopContext.Current.User.CustomerID, false); } bool shoppingCartRequiresShipping = ShippingManager.ShoppingCartRequiresShipping(Cart); if (!shoppingCartRequiresShipping) { SelectAddress(null); Response.Redirect("~/CheckoutBillingAddress.aspx"); } if (!Page.IsPostBack) { AddressCollection addresses = getAllowedShippingAddresses(NopContext.Current.User); if (addresses.Count > 0) { dlAddress.DataSource = addresses; dlAddress.DataBind(); lEnterShippingAddress.Text = GetLocaleResourceString("Checkout.OrEnterNewAddress"); } else { pnlSelectShippingAddress.Visible = false; lEnterShippingAddress.Text = GetLocaleResourceString("Checkout.EnterShippingAddress"); } } }
public void AddressCollectionOperations() { IDictionary <string, object> properties = new Dictionary <string, object>(); AppProperties appProperties = new AppProperties(properties); appProperties.Addresses = AddressCollection.Create(); appProperties.Addresses.Add(new Address("http", "*", "80", "/")); Assert.Equal(1, appProperties.Addresses.Count); Assert.Equal("http", appProperties.Addresses[0].Scheme); foreach (Address address in appProperties.Addresses) { Assert.Equal("http", address.Scheme); Assert.Equal("*", address.Host); Assert.Equal("80", address.Port); Assert.Equal("/", address.Path); } }
public static void UseUdpDiscovery(this IAppBuilder app) { var context = new OwinContext(app.Properties); var hostAddresses = context.Get <IList <IDictionary <string, object> > >("host.Addresses"); var addresses = new AddressCollection(hostAddresses); var cancel = context.Get <CancellationToken>("host.OnAppDisposing"); var uris = addresses .Where(a => !string.IsNullOrEmpty(a.Port)) .Select(a => new UriBuilder(a.Scheme, a.Host, int.Parse(a.Port), a.Path).ToString()) .ToList(); RunDiscoveryListener(uris, cancel).ContinueWith(t => { if (t.Exception != null) { Trace.WriteLine("There were problems with discovery: " + t.Exception.ToString()); } }); }
public static void SaveMailContacts(IDbManager db, int tenant, string user, Message message, ILogger log) { try { var contacts = new AddressCollection { message.From }; contacts.AddRange(message.To); contacts.AddRange(message.Cc); contacts.AddRange(message.Bcc); var valid_contacts = (from contact in contacts where MailContactExists(db, tenant, user, contact.Name, contact.Email) < 1 select contact).ToList(); if (!valid_contacts.Any()) { return; } var last_modified = DateTime.Now; var insert_query = new SqlInsert(ContactsTable.name) .InColumns(ContactsTable.Columns.id_user, ContactsTable.Columns.id_tenant, ContactsTable.Columns.name, ContactsTable.Columns.address, ContactsTable.Columns.last_modified); valid_contacts .ForEach(contact => insert_query .Values(user, tenant, contact.Name, contact.Email, last_modified)); db.ExecuteNonQuery(insert_query); } catch (Exception e) { log.Warn("SaveMailContacts(tenant={0}, userId='{1}', mail_id={2}) Exception:\r\n{3}\r\n", tenant, user, message.Id, e.ToString()); } }
public Contact(XElement element) { ContactID = XElementHelper.ValueOrDefault<Guid>(element.Element("ContactID")); ContactStatus = XElementHelper.ValueOrDefault<string>(element.Element("ContactStatus")); Name = XElementHelper.ValueOrDefault<string>(element.Element("Name")); FirstName = XElementHelper.ValueOrDefault<string>(element.Element("FirstName")); LastName = XElementHelper.ValueOrDefault<string>(element.Element("LastName")); EmailAddress = XElementHelper.ValueOrDefault<string>(element.Element("EmailAddress")); BankAccountDetails = XElementHelper.ValueOrDefault<string>(element.Element("BankAccountDetails")); TaxNumber = XElementHelper.ValueOrDefault<string>(element.Element("TaxNumber")); AccountsReceivableTaxType = XElementHelper.ValueOrDefault<string>(element.Element("AccountsReceivableTaxType")); AccountsPayableTaxType = XElementHelper.ValueOrDefault<string>(element.Element("AccountsPayableTaxType")); Addresses = new AddressCollection(element.Element("Addresses")); Phones = new PhoneCollection(element.Element("Phones")); UpdatedDateUTC = XElementHelper.ValueOrDefault<DateTime>(element.Element("UpdatedDateUTC")); ContactGroups = XElementHelper.ValueOrDefault<string>(element.Element("ContactGroups")); IsSupplier = XElementHelper.ValueOrDefault<bool>(element.Element("IsSupplier")); IsCustomer = XElementHelper.ValueOrDefault<bool>(element.Element("IsCustomer")); DefaultCurrency = XElementHelper.ValueOrDefault<string>(element.Element("DefaultCurrency")); }
protected AddressCollection getAllowedBillingAddresses(Customer customer) { AddressCollection addresses = new AddressCollection(); if (customer == null) { return(addresses); } foreach (Address address in customer.BillingAddresses) { Country country = address.Country; if (country != null && country.AllowsBilling) { addresses.Add(address); } } return(addresses); }
protected AddressCollection GetAllowedShippingAddresses(Customer customer) { var addresses = new AddressCollection(); if (customer == null) { return(addresses); } foreach (var address in customer.ShippingAddresses) { var country = address.Country; if (country != null && country.AllowsShipping) { addresses.Add(address); } } return(addresses); }
public Boolean AddToAddressWithName(string strTo, string strToName) { try { if (Session["To"] != null && Session["To"] as AddressCollection != null) { ((AddressCollection)Session["To"]).Add(new Address(strTo, strToName)); } else { Session["To"] = new AddressCollection(); ((AddressCollection)Session["To"]).Add(new Address(strTo, strToName)); } return true; } catch { return false; } }
public Boolean AddToAddressWithName(string strTo, string strToName) { try { if (Session["To"] != null && Session["To"] as AddressCollection != null) { ((AddressCollection)Session["To"]).Add(new Address(strTo, strToName)); } else { Session["To"] = new AddressCollection(); ((AddressCollection)Session["To"]).Add(new Address(strTo, strToName)); } return(true); } catch { return(false); } }
public Boolean AddHostWithPort(string host, int port) { try { if (Session["Hosts"] != null && Session["Hosts"] as ServerCollection != null) { ((ServerCollection)Session["Hosts"]).Add(host, port); } else { Session["Hosts"] = new AddressCollection(); ((ServerCollection)Session["Hosts"]).Add(host, port); } return(true); } catch { return(false); } }
protected void Page_Load(object sender, EventArgs e) { if ((NopContext.Current.User == null) || (NopContext.Current.User.IsGuest && !CustomerManager.AnonymousCheckoutAllowed)) { string loginURL = CommonHelper.GetLoginPageURL(true); Response.Redirect(loginURL); } Cart = ShoppingCartManager.GetCurrentShoppingCart(ShoppingCartTypeEnum.ShoppingCart); IndividualOrderCollection indOrders = IndividualOrderManager.GetCurrentUserIndividualOrders(); if (Cart.Count == 0 && indOrders.Count == 0) { Response.Redirect("~/ShoppingCart.aspx"); } if (!Page.IsPostBack) { Address shippingAddress = NopContext.Current.User.ShippingAddress; pnlTheSameAsShippingAddress.Visible = CustomerManager.CanUseAddressAsBillingAddress(shippingAddress); AddressCollection addresses = getAllowedBillingAddresses(NopContext.Current.User); if (addresses.Count > 0) { //bind data //if (addresses.Count > 1) // addresses.RemoveRange(1, addresses.Count - 1); dlAddress.DataSource = addresses; dlAddress.DataBind(); lEnterBillingAddress.Text = GetLocaleResourceString("Checkout.OrEnterNewAddress"); } else { pnlSelectBillingAddress.Visible = false; lEnterBillingAddress.Text = GetLocaleResourceString("Checkout.EnterBillingAddress"); } } }
public static void CreateUnspentTransactionsOfBlockHeights(AddressCollection addressCollection, Network network, params int[] blockHeights) { for (int i = 0; i < blockHeights.Length; i++) { int height = blockHeights[i]; byte[] buf = new byte[32]; (new Random()).NextBytes(buf); HdAddress address = addressCollection.Account.ExternalAddresses.Skip(i).First(); address.Transactions.Add(new TransactionData { ScriptPubKey = address.ScriptPubKey, Id = new uint256(buf), Index = 0, BlockHeight = height, BlockHash = (uint)height, Amount = new Money(new Random().Next(500000, 1000000)) }); } }
public static void SaveMailContacts(IDbManager db, int tenant, string user, Message message, ILogger log) { try { var contacts = new AddressCollection {message.From}; contacts.AddRange(message.To); contacts.AddRange(message.Cc); contacts.AddRange(message.Bcc); var valid_contacts = (from contact in contacts where MailContactExists(db, tenant, user, contact.Name, contact.Email) < 1 select contact).ToList(); if (!valid_contacts.Any()) return; var last_modified = DateTime.Now; var insert_query = new SqlInsert(ContactsTable.name) .InColumns(ContactsTable.Columns.id_user, ContactsTable.Columns.id_tenant, ContactsTable.Columns.name, ContactsTable.Columns.address, ContactsTable.Columns.last_modified); valid_contacts .ForEach(contact => insert_query .Values(user, tenant, contact.Name, contact.Email, last_modified)); db.ExecuteNonQuery(insert_query); } catch (Exception e) { log.Warn("SaveMailContacts(tenant={0}, userId='{1}', mail_id={2}) Exception:\r\n{3}\r\n", tenant, user, message.Id, e.ToString()); } }
/// <summary> /// Parses a string containing addresses in the following formats : /// <list type="circle"> /// <item>"John Doe" <[email protected]>,"Mike Johns" <[email protected]></item> /// <item>"John Doe" <[email protected]>;"Mike Johns" <[email protected]></item> /// <item><[email protected]></item> /// <item>[email protected]</item> /// </list> /// </summary> /// <param name="input">A string containing addresses in the formats desribed above.</param> /// <returns>An AddressCollection object containing the parsed addresses.</returns> public static AddressCollection ParseAddresses(string input) { //TODO: enforce parser to use regex var addresses = new AddressCollection(); var comma_separated = input.Split(','); for (var i = 0; i < comma_separated.Length; i++) if (comma_separated[i].IndexOf("@", StringComparison.Ordinal) == -1 && comma_separated.Length > (i + 1)) comma_separated[i + 1] = comma_separated[i] + comma_separated[i + 1]; foreach (var t in comma_separated.Where(t => t.IndexOf("@", StringComparison.Ordinal)!=-1)) addresses.Add( ParseAddress(( t.IndexOf("<", StringComparison.Ordinal) != -1 && t.IndexOf(":", StringComparison.Ordinal) != -1 && t.IndexOf(":", StringComparison.Ordinal) < t.IndexOf("<", StringComparison.Ordinal)) ? ((t.Split(':')[0].IndexOf("\"", StringComparison.Ordinal) == -1) ? t.Split(':')[1] : t) : t)); return addresses; }
/// <summary> /// Merge the address collection with the specified item. /// </summary> /// <param name="addresses">The address to merge.</param> /// <param name="item">The item to use for merging.</param> /// <returns>The merged Address colection.</returns> public AddressCollection MergeAddresses(AddressCollection addresses, object item) { int index; for(index=0;index<addresses.Count;index++) { addresses[index].Email = MergeText(addresses[index].Email, item); addresses[index].Name = MergeText(addresses[index].Name, item); } return addresses; }
/// <summary> /// Parses a string containing addresses in the following formats : /// <list type="circle"> /// <item>"John Doe" <[email protected]>,"Mike Johns" <[email protected]></item> /// <item>"John Doe" <[email protected]>;"Mike Johns" <[email protected]></item> /// <item><[email protected]></item> /// <item>[email protected]</item> /// </list> /// </summary> /// <param name="input">A string containing addresses in the formats desribed above.</param> /// <returns>An AddressCollection object containing the parsed addresses.</returns> public static AddressCollection ParseAddresses(string input) { //TODO: enforce parser to use regex AddressCollection addresses = new AddressCollection(); string[] comma_separated = input.Split(','); for (int i = 0; i < comma_separated.Length; i++) if (comma_separated[i].IndexOf("@") == -1 && comma_separated.Length > (i + 1)) comma_separated[i + 1] = comma_separated[i] + comma_separated[i + 1]; for (int i = 0; i < comma_separated.Length; i++) if(comma_separated[i].IndexOf("@")!=-1) addresses.Add(Parser.ParseAddress((comma_separated[i].IndexOf("<") != -1 && comma_separated[i].IndexOf(":") != -1 && comma_separated[i].IndexOf(":") < comma_separated[i].IndexOf("<")) ? ((comma_separated[i].Split(':')[0].IndexOf("\"") == -1) ? comma_separated[i].Split(':')[1] : comma_separated[i]) : comma_separated[i])); //MatchCollection matches = Regex.Matches(input, "(\"(?<name>.+?)\")*\\s*<?(?<email>[^<>,\"\\s]+)>?"); //foreach (Match m in matches) // addresses.Add(m.Groups["email"].Value, m.Groups["name"].Value); return addresses; }
public void Reload() { Addresses = new AddressCollection(Wallet.Addresses.ToList()); if(TableView != null) TableView.ReloadData(); }
public static async Task<Wallet> CreateAsync(byte[] passphrase, FileInfo file = null, PrivateKeyCollection keys = null, AddressCollection publicAddresses = null, AddressCollection watchAddresses = null) { var wallet = new Wallet(file, keys, publicAddresses, watchAddresses); await wallet.LockAsync(passphrase); await wallet.UnlockAsync(passphrase); return wallet; }
protected Wallet(FileInfo file = null, PrivateKeyCollection keys = null, AddressCollection publicAddresses = null, AddressCollection watchAddresses = null) { PrivateKeys = keys ?? new PrivateKeyCollection(); WatchAddresses = watchAddresses ?? new AddressCollection(); PublicAddresses = publicAddresses ?? new AddressCollection(); File = file; }
protected AddressCollection getAllowedShippingAddresses(Customer customer) { AddressCollection addresses = new AddressCollection(); if (customer == null) return addresses; foreach (Address address in customer.ShippingAddresses) { Country country = address.Country; if (country != null && country.AllowsShipping) { addresses.Add(address); } } return addresses; }
public void StoreAddresses() { var collection = new AddressCollection(); var publicAddress = new Address("1ky1eHUrRR1kxKTbfiCptao9V25W97gDm"); var publicDetails = new AddressDetails(publicAddress, "public"); var miningAddress = new Address("1digVweRyrR9NbPaQJ2dfudXcZWQd81au"); var miningDetails = new AddressDetails(miningAddress, "mining"); var miscAddress = new Address("12pa32rAF8dejmKnU6XfXZ3aNCmroVNSQj"); var miscDetails = new AddressDetails(miscAddress); collection.Add(publicDetails); collection.Add(miningDetails); collection.Add(miscAddress); Assert.AreEqual(collection.Count, 3); Assert.AreEqual(collection[0], publicDetails); Assert.AreEqual(collection[publicAddress], publicDetails); Assert.AreEqual(collection[1], miningDetails); Assert.AreEqual(collection[miningAddress], miningDetails); Assert.AreEqual(collection[2], miscDetails); Assert.AreEqual(collection[miscAddress], miscDetails); collection.Remove(publicAddress); Assert.AreEqual(collection.Count, 2); Assert.AreEqual(collection[0], miningDetails); Assert.AreEqual(collection[miningAddress], miningDetails); Assert.AreEqual(collection[1], miscDetails); Assert.AreEqual(collection[miscAddress], miscDetails); collection.Insert(1, publicDetails); Assert.AreEqual(collection.Count, 3); Assert.AreEqual(collection[0], miningDetails); Assert.AreEqual(collection[miningAddress], miningDetails); Assert.AreEqual(collection[1], publicDetails); Assert.AreEqual(collection[publicAddress], publicDetails); Assert.AreEqual(collection[2], miscDetails); Assert.AreEqual(collection[miscAddress], miscDetails); collection.RemoveAt(2); Assert.AreEqual(collection.Count, 2); Assert.AreEqual(collection[0], miningDetails); Assert.AreEqual(collection[miningAddress], miningDetails); Assert.AreEqual(collection[1], publicDetails); Assert.AreEqual(collection[publicAddress], publicDetails); }
public static bool TryParseAddresses(string input, out AddressCollection addresses) { addresses = new AddressCollection(); try { var comma_separated = input.Split(','); for (var i = 0; i < comma_separated.Length; i++) if (comma_separated[i].IndexOf("@", StringComparison.Ordinal) == -1 && comma_separated.Length > (i + 1)) comma_separated[i + 1] = comma_separated[i] + comma_separated[i + 1]; foreach (var t in comma_separated.Where(t => t.IndexOf("@", StringComparison.Ordinal) != -1)) { var address_string = ( t.IndexOf("<", StringComparison.Ordinal) != -1 && t.IndexOf(":", StringComparison.Ordinal) != -1 && t.IndexOf(":", StringComparison.Ordinal) < t.IndexOf("<", StringComparison.Ordinal) ? ((t.Split(':')[0].IndexOf("\"", StringComparison.Ordinal) == -1) ? t.Split(':')[1] : t) : t); Address address; if (TryParseAddress(address_string, out address)) { addresses.Add(address); } } return true; } catch { } return false; }
public static bool TryParseDefectiveHeader(string origanal_header_data, out Header header) { if (string.IsNullOrEmpty(origanal_header_data)) { header = null; return false; } var header_bytes = Encoding.GetEncoding("iso-8859-1").GetBytes(origanal_header_data); header = new Header { OriginalData = header_bytes }; var hdr = origanal_header_data; hdr = RegxHeader.Match(hdr).Value; hdr = RegxUnfold.Replace(hdr, ""); var m = RegxHeaderLines.Match(hdr); while (m.Success) { try { var name = FormatFieldName(m.Value.Substring(0, m.Value.IndexOf(':'))); var value = Codec.RFC2047Decode(m.Value.Substring(m.Value.IndexOf(":", StringComparison.Ordinal) + 1)) .Trim('\r', '\n') .TrimStart(' '); if (name.Equals("received")) { TraceInfo trace; if (TryParseTrace(m.Value.Trim(' '), out trace)) { header.Trace.Add(trace); } } else if (name.Equals("to")) { var address_collection = new AddressCollection(); TryParseAddresses(value, out address_collection); header.To = address_collection; } else if (name.Equals("cc")) { AddressCollection address_collection; if (TryParseAddresses(value, out address_collection)) { header.Cc = address_collection; } } else if (name.Equals("bcc")) { AddressCollection address_collection; if (TryParseAddresses(value, out address_collection)) { header.Bcc = address_collection; } } else if (name.Equals("reply-to")) { Address address; if (TryParseAddress(value, out address)) { header.ReplyTo = address; } } else if (name.Equals("from")) { Address address; if (TryParseAddress(value, out address)) { header.From = address; } } else if (name.Equals("sender")) { Address address; if (TryParseAddress(value, out address)) { header.Sender = address; } } else if (name.Equals("content-type")) { header.ContentType = GetContentType(m.Value); } else if (name.Equals("content-disposition")) { header.ContentDisposition = GetContentDisposition(m.Value); } header.HeaderFields.Add(name, value); header.HeaderFieldNames.Add(name, m.Value.Substring(0, m.Value.IndexOf(':'))); } catch { } m = m.NextMatch(); } return true; }
public static IAsyncResult BeginFilter(AddressCollection addresses, ServerCollection dnsServers, AsyncCallback callback) { SmtpValidator._delegateFilterServers = SmtpValidator.Filter; return SmtpValidator._delegateFilterServers.BeginInvoke(addresses, dnsServers, callback, SmtpValidator._delegateFilterServers); }
/// <summary> /// Loads the addresses. /// </summary> /// <param name="addressType">Type of the address.</param> /// <returns></returns> private AddressCollection LoadAddresses(AddressType addressType) { List<Address> addressList = _user.AddressCollection.FindAll(delegate(Address address) { return address.AddressType == addressType; }); AddressCollection addressCollection = new AddressCollection(); addressCollection.AddRange(addressList); return addressCollection; }
public IAsyncResult BeginVerify(AddressCollection addresses, AsyncCallback callback) { this._delegateVrfyAddressCollection = this.Verify; return this._delegateVrfyAddressCollection.BeginInvoke(addresses, callback, this._delegateVrfyAddressCollection); }
public static async Task<Wallet> CreateAsync(string passphrase, FileInfo file = null, PrivateKeyCollection keys = null, AddressCollection publicAddresses = null, AddressCollection watchAddresses = null) { return await CreateAsync(Encoding.UTF8.GetBytes(passphrase), file, keys, publicAddresses, watchAddresses); }
public static IAsyncResult BeginGetInvalidAddresses(AddressCollection addresses, ServerCollection dnsServers, AsyncCallback callback) { SmtpValidator._delegateGetInvalidAddressesServers = SmtpValidator.GetInvalidAddresses; return SmtpValidator._delegateGetInvalidAddressesServers.BeginInvoke(addresses, dnsServers, callback, SmtpValidator._delegateGetInvalidAddressesServers); }
/// <summary> /// Loads the addresses. /// </summary> public void LoadAddresses() { List<Address> addressList = WebProfile.Current.AddressCollection.FindAll(delegate(Address address) { return address.AddressType == this.AddressType; }); AddressCollection addressCollection = new AddressCollection(); addressCollection.AddRange(addressList); if(addressCollection != null) { if(addressCollection.Count > 0) { ddlAddress.Items.Clear(); foreach(Address address in addressCollection) { ddlAddress.Items.Add(new ListItem(string.Format("{0} {1}, {2} {3}, {4}, {5} {6}", address.FirstName, address.LastName, address.Address1, address.Address2, address.City, address.StateOrRegion, address.PostalCode), address.AddressId.ToString())); } ddlAddress.Items.Insert(0, new ListItem(LocalizationUtility.GetText("lblSelect"), string.Empty)); if(!string.IsNullOrEmpty(_selectedAddress)) { if (ddlAddress.Items.FindByValue(_selectedAddress) != null) ddlAddress.SelectedValue = _selectedAddress; } } else {//No addresses yet ShowAddressPanel(); pnlAddNew.Visible = false; } } }
public Boolean AddHostWithPort(string host, int port) { try { if (Session["Hosts"] != null && Session["Hosts"] as ServerCollection != null) { ((ServerCollection)Session["Hosts"]).Add(host, port); } else { Session["Hosts"] = new AddressCollection(); ((ServerCollection)Session["Hosts"]).Add(host, port); } return true; } catch { return false; } }
//Address parsing conformant to RFC2822's addr-spec. /// <summary> /// Parses a string containing addresses in the following formats : /// <list type="circle"> /// <item>"John Doe" <[email protected]>,"Mike Johns" <[email protected]></item> /// <item>"John Doe" <[email protected]>;"Mike Johns" <[email protected]></item> /// <item><[email protected]></item> /// <item>[email protected]</item> /// </list> /// </summary> /// <param name="input">A string containing addresses in the formats desribed above.</param> /// <returns>An AddressCollection object containing the parsed addresses.</returns> public static AddressCollection ParseAddresses(string input) { AddressCollection addresses = new AddressCollection(); string[] comma_separated = input.Split(','); for(int i=0;i<comma_separated.Length;i++) if(comma_separated[i].IndexOf("@")==-1 && comma_separated.Length>(i+1)) comma_separated[i+1] = comma_separated[i]+comma_separated[i+1]; for(int i=0;i<comma_separated.Length;i++) /*if(comma_separated[i].IndexOf("@")!=-1)*/ addresses.Add(Parser.ParseAddress((comma_separated[i].IndexOf("<")!=-1 && comma_separated[i].IndexOf(":")!=-1 && comma_separated[i].IndexOf(":")<comma_separated[i].IndexOf("<")) ? ((comma_separated[i].Split(':')[0].IndexOf("\"")==-1) ? comma_separated[i].Split(':')[1] : comma_separated[i]) : comma_separated[i])); return addresses; }
/// <summary> /// Merge the Address collection with the specified datasource. /// </summary> /// <param name="addresses">The addresses to merge.</param> /// <param name="dataSource">The datasource to use for merging.</param> /// <param name="repeat">Specify if the texts will be repeated or not.</param> /// <returns>The merged Address collection</returns> public AddressCollection MergeAddresses(AddressCollection addresses, object dataSource, bool repeat) { int index; for(index=0;index<addresses.Count;index++) { addresses[index].Email = MergeText(addresses[index].Email, dataSource, repeat); addresses[index].Name = MergeText(addresses[index].Name, dataSource, repeat); } return addresses; }
public IAsyncResult BeginRcptTo(AddressCollection addresses, AsyncCallback callback) { this._delegateRcptToAddressCollection = this.RcptTo; return this._delegateRcptToAddressCollection.BeginInvoke(addresses, callback, this._delegateRcptToAddressCollection); }
/// <summary> /// Validates syntax and existence of the given address and returns valid addresses. /// </summary> /// <param name="addresses">The collection to be filtered.</param> /// <param name="dnsServers">Name Servers to be used for MX records search.</param> /// <returns>A collection containing the valid addresses.</returns> public static AddressCollection Filter(AddressCollection addresses, ServerCollection dnsServers) { ActiveUp.Net.Mail.AddressCollection valids = new ActiveUp.Net.Mail.AddressCollection(); ActiveUp.Net.Mail.AddressCollection valids1 = new ActiveUp.Net.Mail.AddressCollection(); System.Collections.Specialized.HybridDictionary ads = new System.Collections.Specialized.HybridDictionary(); for (int i = 0; i < addresses.Count; i++) if (ActiveUp.Net.Mail.Validator.ValidateSyntax(addresses[i].Email)) valids.Add(addresses[i]); #if !PocketPC System.Array domains = System.Array.CreateInstance(typeof(string), new int[] { valids.Count }, new int[] { 0 }); System.Array adds = System.Array.CreateInstance(typeof(ActiveUp.Net.Mail.Address), new int[] { valids.Count }, new int[] { 0 }); #else System.Array domains = System.Array.CreateInstance(typeof(string), new int[] { valids.Count }); System.Array adds = System.Array.CreateInstance(typeof(ActiveUp.Net.Mail.Address), new int[] { valids.Count }); #endif for (int i = 0; i < valids.Count; i++) { domains.SetValue(valids[i].Email.Split('@')[1], i); adds.SetValue(valids[i], i); } System.Array.Sort(domains, adds, null); string currentDomain = ""; string address = ""; ActiveUp.Net.Mail.SmtpClient smtp = new ActiveUp.Net.Mail.SmtpClient(); bool isConnected = false; for (int i = 0; i < adds.Length; i++) { address = ((ActiveUp.Net.Mail.Address)adds.GetValue(i)).Email; if (((string)domains.GetValue(i)) == currentDomain) { if (!smtp.Verify(address)) { try { //smtp.MailFrom("postmaster@"+System.Net.Dns.GetHostName()); //smtp.MailFrom("postmaster@"+currentDomain); smtp.RcptTo(address); valids1.Add((ActiveUp.Net.Mail.Address)adds.GetValue(i)); } catch { } } else valids1.Add((ActiveUp.Net.Mail.Address)adds.GetValue(i)); } else { currentDomain = (string)domains.GetValue(i); try { if (isConnected == true) { isConnected = false; smtp.Disconnect(); smtp = new ActiveUp.Net.Mail.SmtpClient(); } smtp.Connect(ActiveUp.Net.Mail.Validator.GetMxRecords(currentDomain, dnsServers).GetPrefered().Exchange); isConnected = true; try { smtp.Ehlo(System.Net.Dns.GetHostName()); } catch { smtp.Helo(System.Net.Dns.GetHostName()); } if (!smtp.Verify(address)) { try { //smtp.MailFrom("postmaster@"+System.Net.Dns.GetHostName()); //smtp.MailFrom("*****@*****.**"); smtp.MailFrom("postmaster@" + currentDomain); smtp.RcptTo(address); valids1.Add((ActiveUp.Net.Mail.Address)adds.GetValue(i)); } catch { } } else valids1.Add((ActiveUp.Net.Mail.Address)adds.GetValue(i)); } catch { } } } if (isConnected == true) smtp.Disconnect(); return valids1; }