public void InsertEntityGraphSingles() { var debugToken = "InsertEntityGraphSingles()"; Entity myNewEntity = new Entity { Type = 0, SecurityType = 1, DebugToken = debugToken }; EntityName myNewEntityName = new EntityName { First = "joe", Last = "blow", Type = 0, DebugToken = debugToken }; EntityAddress myNewEntityAddress = new EntityAddress { Address1 = "addy1", City = "MyCity", State = "MyState", PostalCode = "12345", Country = "whoknows", Type = 0 }; EntityPhone myNewEntityPhone = new EntityPhone { Type = 0, Phone = "1112223333" }; EntityEmail myNewEntityEmail = new EntityEmail { Type = 0, Email = "*****@*****.**" }; EntityCreditCard myNewEntityCreditCard = new EntityCreditCard { Type = 0, CC = "123", Code = 123, ExpirationMonth = "2", ExpirationYear = "2017" }; EntitySocialMedia myNewEntitySocialMedia = new EntitySocialMedia { Type = 0, Url = "somethingcool.com", Login = "******", PW = "pw" }; myNewEntity.Names.Add(myNewEntityName); myNewEntity.Addresses.Add(myNewEntityAddress); myNewEntity.Phones.Add(myNewEntityPhone); myNewEntity.Emails.Add(myNewEntityEmail); myNewEntity.CreditCards.Add(myNewEntityCreditCard); myNewEntity.SocialMedia.Add(myNewEntitySocialMedia); SaveEntityChanges(myNewEntity); }
protected void btnAssign1_Click(object sender, EventArgs e) { int EmailId = Convert.ToInt32(txtEmailId.Text); EmailRepository emailReb = new EmailRepository(); gvEmails.DataBind(); string emailRef = "NPO#" + EmailId; DataTable dataTable = emailReb.GetEmailAssignUsers(EmailId); string emails = ""; for (int i = 0; i < dataTable.Rows.Count; i++) { emails += dataTable.Rows[i][2].ToString() + ","; } EntityEmail email = new EntityEmail(); email.To = emails; email.Body = "you have a new Assign search By Email Reference : " + emailRef; email.Subject = "NPO Tool"; if (MailHelper.SendMail(email)) { emailReb.UpdateIsAssign(EmailId, 1, 0); } Page.Response.Redirect(Page.Request.Url.ToString(), true); }
/* * First will search in subject about controllers name or site code or site name * if exist go to and insert in database and assign users * else go to search in body about same if exist make same * if not exist in subject or body Exit from function and don't assign any user in this case Admin will assign manually * */ private void AssignAuto(EmailMessage email, int id) { List <int> controllerId; List <int> conIdSub = SubContainsCon(email); if (conIdSub[0] == -1) { List <int> conIdBody = BodyContainsCon(email); if (conIdBody[0] == -1) { return; } else { controllerId = conIdBody.Distinct().ToList(); } } else { controllerId = conIdSub.Distinct().ToList(); } EmailRepository updateEmail = new EmailRepository(); string emailRef = "NPO#" + id; string emails = ""; updateEmail.UpdateStutes(emailRef, id); if (controllerId.Count != 0) { for (int i = 0; i < controllerId.Count; i++) { if (controllerId[i] != 0) { updateEmail.AddControllerId(controllerId[i], id); DataTable dataTable = updateEmail.GetControllerAssignUsers(controllerId[i]); foreach (DataRow item in dataTable.Rows) { updateEmail.AddUserEmail(Convert.ToInt32(item["UserId"]), id); emails += item["EmailAddress"].ToString() + ","; } } } EntityEmail sendEmail = new EntityEmail(); sendEmail.To = emails; sendEmail.Body = "you have a new Assign search By Email Reference : " + emailRef; sendEmail.Subject = "NPO Tool"; MailHelper.SendMail(sendEmail); } }
public void InsertEntityAndEmail() { var debugToken = "InsertEntityAndEmail()"; Entity myNewEntity = new Entity { Type = 0, SecurityType = 1, DebugToken = debugToken }; EntityEmail myNewEntityEmail = new EntityEmail { Type = 0, Email = "*****@*****.**" }; myNewEntity.Emails.Add(myNewEntityEmail); SaveEntityChanges(myNewEntity); }
private void SendMailPassword(User user) { if (txtEmailAddressAdd.ToString().Trim() != string.Empty) { EntityEmail email = new EntityEmail(); email.To = user.EmailAddress.Trim(); email.Subject = "Welcome into NPO tool"; email.Body = @" Welcome " + user.FullName + @" , you have now new account in NPO tool <br/> EmailAddress : " + user.NokiaUserName.Trim() + @"<br/> password :" + user.Password; MailHelper.SendMail(email); } }
public int SendEmail(string NokiaUserName) { ExchangeService _service = MailHelper.Exchange_Service(); string email = string.Empty; string password = string.Empty; using (SqlConnection con = new SqlConnection(DBHelper.strConnString)) { using (SqlCommand cmd = new SqlCommand("SELECT EmailAddress, [Password] , NokiaUserName FROM [User] WHERE NokiaUserName = @NokiaUserName")) { cmd.Parameters.AddWithValue("@NokiaUserName", NokiaUserName.Trim()); cmd.Connection = con; con.Open(); using (SqlDataReader sdr = cmd.ExecuteReader()) { if (sdr.Read()) { email = sdr["EmailAddress"].ToString(); password = sdr["Password"].ToString(); } } con.Close(); } } if (!string.IsNullOrEmpty(password)) { EntityEmail sendemail = new EntityEmail(); sendemail.To = email.Trim(); sendemail.Subject = "Password Recovery"; sendemail.Body = string.Format("Hi {0},<br /><br />Your password is {1}.<br /><br />Thank You.", NokiaUserName, password); bool check = MailHelper.SendMail(sendemail); if (check) { return(1); } else { return(2); } } return(2); }