private void panelEmailSupport_Click_1(object sender, EventArgs e) { EmailSupport _EmailSupport = new EmailSupport(this); _EmailSupport.Closed += _EmailSupport_Closed; _EmailSupport.Shown += _EmailSupport__Shown; _EmailSupport.swipe(true); }
public async Task <int> UpdateEmailSupport(EmailSupport ObjEmailSupport) { try { db.Entry(ObjEmailSupport).State = EntityState.Modified; return(await db.SaveChangesAsync()); } catch (Exception ex) { return(0); } }
public int CreateEmailSupport(EmailSupport ObjEmailSupport) { try { db.EmailSupports.Add(ObjEmailSupport); return(db.SaveChanges()); } catch (Exception e) { return((int)EnumCore.Result.action_false); } }
public async Task <int> CreateEmailSupportAsync(EmailSupport ObjEmailSupport) { try { db.EmailSupports.Add(ObjEmailSupport); return(await db.SaveChangesAsync()); } catch (Exception e) { return((int)EnumCore.Result.action_false); } }
public async Task <int> DeleteEmailSupport(EmailSupport EmailSupportObj) { try { db.EmailSupports.Remove(EmailSupportObj); return(await db.SaveChangesAsync()); } catch (Exception ex) { return(0); } }
private void SendMail(string mailSubject, string mailBody) { EmailSupport email = new EmailSupport(); DataSet dsIntercoCountries = this.GetEntity().GetCustomDataSet("GetIntercoCountries", this); foreach (DataRow row in dsIntercoCountries.Tables[0].Rows) { string mailTo = row["Email"].ToString(); if (!String.IsNullOrEmpty(mailTo)) { email.SendMailMessage(Settings.MailServer, Settings.MailFrom, mailTo, mailSubject, mailBody); } } }
protected async void btnSendInformation_Click(object sender, EventArgs e) { string emailDomain = ""; string errorText = ""; UtilityClasses.EmailSupport emailSupport = new EmailSupport(); Task <SqlConnection> conn = OpenDatabase(); if (ddlCarrier.SelectedItem.Text == "ATT") { emailDomain = "txt.att.net"; } else { emailDomain = "vtext.com"; } bool sent = false; sent = emailSupport.SendATextMessage(txtboxFromAddress.Text, txtboxPassword.Text, txtboxCellNumber.Text + "@" + emailDomain, "text", txtBoxMsg.Text, ref errorText); if (sent == true) { txtBoxMsg.ForeColor = System.Drawing.Color.Green; } else { txtBoxMsg.ForeColor = System.Drawing.Color.Black; } SqlConnection connection = await conn; string sqlInsert = "INSERT INTO Texts (TextMessage, TextDate) VALUES ('" + txtBoxMsg.Text + "','" + DateTime.Now.ToString() + "')"; SqlCommand cmd = new SqlCommand(sqlInsert); cmd.Connection = connection; try { cmd.ExecuteNonQuery(); lstboxPreviousTexts.Items.Add(txtBoxMsg.Text.Substring(0, Math.Min(txtBoxMsg.Text.Length, 15))); } catch (SqlException sqlEx) { sqlEx.GetHashCode(); } connection.Close(); }
//tạo đã xem cho email private int CreateEmailView(EmailSupport item, long UID) { ContentView ck = cms_db.GetObjContentView(item.EmailId, (int)EnumCore.ObjTypeId.emailsupport, UID); if (ck == null) { ContentView tmp = new ContentView(); tmp.UserId = UID; tmp.UserName = User.Identity.GetUserName(); tmp.ContentId = item.EmailId; tmp.ContentType = (int)EnumCore.ObjTypeId.emailsupport; tmp.ContentName = item.Subject; cms_db.CreateContentView(tmp); } return(1); }
public async Task <ActionResult> ClearEmail(long[] lstClear) { try { string AlertString = ""; ///phải là mod hay admin mới có thể tạo thư trả lời if (User.IsInRole("AdminUser") || User.IsInRole("devuser") || User.IsInRole("supperadmin") || User.IsInRole("Mod")) { foreach (long item in lstClear) { EmailSupport objF = cms_db.GetObjEmailSupport(item); List <EmailSupport> lstChild = cms_db.GetlstEmailSupport().Where(s => s.ParentId == item).ToList(); foreach (EmailSupport childItem in lstChild) { await cms_db.ClearEmailSupport(childItem, (int)EnumCore.EmailClearType.xoa_mail_mod); } await cms_db.ClearEmailSupport(objF, (int)EnumCore.EmailClearType.xoa_mail_mod); } AlertString = "Đã xoá thư thành công"; return(RedirectToAction("AlertPage", "Extension", new { AlertString = AlertString, type = (int)EnumCore.AlertPageType.FullScrenn })); } else //User.IsInRole("Member") { foreach (long item in lstClear) { EmailSupport objF = cms_db.GetObjEmailSupport(item); List <EmailSupport> lstChild = cms_db.GetlstEmailSupport().Where(s => s.ParentId == item).ToList(); foreach (EmailSupport childItem in lstChild) { await cms_db.ClearEmailSupport(childItem, (int)EnumCore.EmailClearType.xoa_mail_member); } await cms_db.ClearEmailSupport(objF, (int)EnumCore.EmailClearType.xoa_mail_mod); } AlertString = "Đã xoá thư thành công"; return(RedirectToAction("AlertPage", "Extension", new { AlertString = AlertString, type = (int)EnumCore.AlertPageType.FullScrenn })); } } catch (Exception e) { cms_db.AddToExceptionLog("ClearEmail", "EmailManager", e.ToString(), long.Parse(User.Identity.GetUserId())); string AlertString = "Có lỗi khi xoá thư vui lòng thử lại sau"; return(RedirectToAction("AlertPage", "Extension", new { AlertString = AlertString, type = (int)EnumCore.AlertPageType.FullScrenn })); } }
private void AddAccountEmailAddressHandling() { string emailRootID = TBREmailRoot.GetIDFromEmailAddress(EmailAddress); TBREmailRoot emailRoot = TBREmailRoot.RetrieveFromDefaultLocation(emailRootID); if (emailRoot != null) { throw new InvalidDataException("Email address '" + EmailAddress + "' is already registered to the system."); } string accountID = StorageSupport.GetAccountIDFromLocation(this.RelativeLocation); VirtualOwner owner = VirtualOwner.FigureOwner(this); TBEmailValidation emailValidation = new TBEmailValidation(); emailValidation.AccountID = accountID; emailValidation.Email = this.EmailAddress; emailValidation.ValidUntil = DateTime.UtcNow.AddMinutes(30); StorageSupport.StoreInformation(emailValidation); EmailSupport.SendValidationEmail(emailValidation); }
private void simpleButton1_Click(object sender, EventArgs e) { if (txtTaikhoan.Text == "") { XtraMessageBox.Show("Vui lòng nhập đủ thông tin"); } else { NhanvienDao nvdao = new NhanvienDao(); if (nvdao.kiemtrataikhoantontai(txtTaikhoan.Text) == false) { XtraMessageBox.Show("Tên tài khoản không tồn tại!!"); } else { EmailSupport emailsp = new EmailSupport(); emailsp.guiemail(txtTaikhoan.Text); this.Close(); } } }
public async Task <ActionResult> CreateNewEmail(EmailSupportViewModel model) { try { long UID = long.Parse(User.Identity.GetUserId()); EmailSupport newObject = model._MainObj; newObject.EmailName = model.Subject; newObject.CrtdDT = DateTime.Now; newObject.CrtdUserId = long.Parse(User.Identity.GetUserId()); newObject.CrtdUserName = User.Identity.Name; newObject.StateId = (int)EnumCore.EmailStatus.cho_ho_tro; newObject.StateName = "Chờ hỗ trợ"; if (model.DestinationId.HasValue) { newObject.DestinationId = model.DestinationId; newObject.DestinationName = model.DestinationName; } else { newObject.DestinationId = -1; } int rs = cms_db.CreateEmailSupport(newObject); //member tạo ra chắc chắn là member đã xems //tạo d8ã xem cho email mới tạo int rsv = this.CreateEmailView(newObject, UID); int ach = await cms_db.CreateUserHistory(UID, Request.ServerVariables["REMOTE_ADDR"], (int)EnumCore.ActionType.Update, "CreateNewEmail", newObject.EmailId, newObject.Subject, "EmailSupport", (int)EnumCore.ObjTypeId.emailsupport); var context = GlobalHost.ConnectionManager.GetHubContext <NotifiHub>(); context.Clients.All.notificationNewEmail(); return(RedirectToAction("Index")); } catch (Exception e) { cms_db.AddToExceptionLog("CreateNewEmail", "EmailManager", e.ToString(), long.Parse(User.Identity.GetUserId())); return(RedirectToAction("Index")); } }
public bool SendEmail(String from, String[] to, String[] cc, String[] bcc, String subject, String body) { System.Net.Mail.MailAddress fromAddress = new System.Net.Mail.MailAddress(from); System.Net.Mail.MailAddress[] toAddresses = new System.Net.Mail.MailAddress[to.Length]; int x = 0; foreach (String toAddress in to) { toAddresses[x] = new System.Net.Mail.MailAddress(toAddress); x++; } System.Net.Mail.MailAddress[] ccAddresses = null; if (cc != null) { ccAddresses = new System.Net.Mail.MailAddress[cc.Length]; x = 0; foreach (string ccAddress in cc) { ccAddresses[x] = new System.Net.Mail.MailAddress(ccAddress); x++; } } System.Net.Mail.MailAddress[] bccAddresses = null; if (bcc != null) { bccAddresses = new System.Net.Mail.MailAddress[bcc.Length]; x = 0; foreach (string bccAddress in bcc) { bccAddresses[x] = new System.Net.Mail.MailAddress(bccAddress); x++; } } MOBOT.Utility.EmailSupport emailSupport = new EmailSupport( Config.ConfigurationManager.AppSettings["SMTPHost"]); return(emailSupport.Send(toAddresses, fromAddress, subject, body, null, bccAddresses, ccAddresses, System.Net.Mail.MailPriority.Normal, null)); }
public async Task <int> ClearEmailSupport(EmailSupport EmailSupportObj, int clearType) { try { if (clearType == (int)EnumCore.EmailClearType.xoa_mail_mod) { EmailSupportObj.StateName = "Đã xoá"; EmailSupportObj.StateId = (int)EnumCore.EmailStatus.da_xoa; db.Entry(EmailSupportObj).State = EntityState.Modified; return(await db.SaveChangesAsync()); } else { EmailSupportObj.StateName2 = "Đã xoá"; EmailSupportObj.StateId2 = (int)EnumCore.EmailStatus.da_xoa; db.Entry(EmailSupportObj).State = EntityState.Modified; return(await db.SaveChangesAsync()); } } catch (Exception ex) { return((int)EnumCore.Result.action_false); } }
private static void TestEmail() { EmailSupport.SendEmail("*****@*****.**", "*****@*****.**", "The Ball - Says Hello!", "Text testing..."); }
public EmailSupportViewModel(EmailSupport model) { _MainObj = model; }
public EmailSupportViewModel() { _MainObj = new EmailSupport(); }
public static void ExecuteMethod_SendEmailConfirmation(TBEmailValidation emailValidation, TBRGroupRoot groupRoot) { EmailSupport.SendGroupJoinEmail(emailValidation, groupRoot.Group); }
public async Task <ActionResult> ReplyEmail(EmailSupportViewModel model) { try { string AlertString = ""; ///phải là mod hay admin mới có thể tạo thư trả lời if (!User.IsInRole("AdminUser") && !User.IsInRole("devuser") && !User.IsInRole("supperadmin") && !User.IsInRole("Mod")) { AlertString = "Tạo mới thư trả lời thư không thành công do bạn không phải là mod"; return(RedirectToAction("AlertPage", "Extension", new { AlertString = AlertString, type = (int)EnumCore.AlertPageType.FullScrenn })); } long ModUserId = long.Parse(User.Identity.GetUserId()); User ModUser = await cms_db.GetObjUserById(ModUserId); EmailSupport SubjectEmail = cms_db.GetObjEmailSupport(model.EmailId); if (SubjectEmail.DestinationId != -1) { AlertString = "Tạo mới thư trả lời thư không thành công đã có mod hỗ trợ"; return(RedirectToAction("AlertPage", "Extension", new { AlertString = AlertString, type = (int)EnumCore.AlertPageType.FullScrenn })); } SubjectEmail.DestinationId = ModUser.Id; SubjectEmail.DestinationName = ModUser.FullName; ///cập nhật lại người nhận là mod cho email hỏi await cms_db.UpdateEmailSupport(SubjectEmail); User MemberUser = await cms_db.GetObjUserById(SubjectEmail.CrtdUserId.Value); EmailSupport ReplyEmailSuport = new EmailSupport(); //vì day là email trả lời mod trả lời nên DestinationId là id của member tạo ra thư ReplyEmailSuport.DestinationName = MemberUser.FullName; ReplyEmailSuport.DestinationId = MemberUser.Id; //vì day là email trả lời mod trả lời nên ParentId là id của thư chủ ReplyEmailSuport.ParentId = SubjectEmail.EmailId; ReplyEmailSuport.ParentName = SubjectEmail.Subject; ReplyEmailSuport.Content = model.Content; ReplyEmailSuport.EmailName = SubjectEmail.Subject; ReplyEmailSuport.CrtdDT = DateTime.Now; ReplyEmailSuport.CrtdUserId = ModUserId; ReplyEmailSuport.CrtdUserName = ModUser.FullName; ReplyEmailSuport.StateId = (int)EnumCore.EmailStatus.da_ho_tro; ReplyEmailSuport.StateName = "Đã hỗ trợ"; int rs = cms_db.CreateEmailSupport(ReplyEmailSuport); //mod tạo ra mail này chắc nchan moad dã xem mình trả lời int rsv = this.CreateEmailView(ReplyEmailSuport, ModUserId); int ach = await cms_db.CreateUserHistory(ModUserId, Request.ServerVariables["REMOTE_ADDR"], (int)EnumCore.ActionType.Update, "ReplyEmail", ReplyEmailSuport.EmailId, ReplyEmailSuport.Subject, "EmailSupport", (int)EnumCore.ObjTypeId.emailsupport); AlertString = "Tạo mới thư trả lời thư thành công"; return(RedirectToAction("AlertPage", "Extension", new { AlertString = AlertString, type = (int)EnumCore.AlertPageType.FullScrenn })); } catch (Exception e) { cms_db.AddToExceptionLog("CreateNewEmail", "EmailManager", e.ToString(), long.Parse(User.Identity.GetUserId())); string AlertString = "Tạo mới thư trả lời thư không thành công do có lỗi khi tạo"; return(RedirectToAction("AlertPage", "Extension", new { AlertString = AlertString, type = (int)EnumCore.AlertPageType.FullScrenn })); } }
public static void ExecuteMethod_SendEmailConfirmation(DeviceMembership deviceMembership, TBEmailValidation emailValidation, string[] ownerEmailAddresses) { EmailSupport.SendDeviceJoinEmail(emailValidation, deviceMembership, ownerEmailAddresses); }
public static void ExecuteMethod_SendEmailConfirmation(InformationInput informationInput, TBEmailValidation emailValidation, string[] ownerEmailAddresses) { EmailSupport.SendInputJoinEmail(emailValidation, informationInput, ownerEmailAddresses); }