public ActionResult DoAddcustomer(UserInfo userInfo, string GroupId) { var result = new ActionBusinessResult(); try { var userBL = new UserBL(); userInfo.CreatedBy = SessionData.CurrentUser.Username; result = userBL.AddUser(userInfo, GroupId); string _pass = userInfo.Password; if (result.IsActionSuccess == true) { Email_Info _Email_Info = new Email_Info { EmailFrom = EmailHelper.EmailOriginal.EMailFrom, Pass = EmailHelper.EmailOriginal.PassWord, Display_Name = EmailHelper.EmailOriginal.DisplayName, EmailTo = userInfo.Email, EmailCC = "", Subject = "Email thông báo đăng ký mở tài khoản thành công", Content = "Dear " + userInfo.FullName + ", Quí khách đăng ký thành công tài khoản username:"******" password:"******"\n quí khách vui lòng truy cập vào địa chỉ <a href='http://pathlaw.net/vi-vn/account/login'>http://pathlaw.net/vi-vn/account/login</a> để đổi mật khẩu của tài khoản. \n cảm ơn quí khách hàng. ", LstAttachment = new List <string>(), }; CommonFunction.AppsCommon.EnqueueSendEmail(_Email_Info); } } catch (Exception ex) { Logger.LogException(ex); } return(Json(new { result = result.ToJson() })); }
public ActionResult Do_Fogot_Pass(string gmail) { bool _ck = false; try { UserInfo _user = new UserInfo(); UserBL _userBL = new UserBL(); _user = _userBL.GetBy_Email(gmail); List <string> _LstAttachment = new List <string>(); if (_user == null || _user.Id == 0) { return(Json(new { success = -2 })); } DateTime currentTime = DateTime.Now; DateTime current = currentTime.AddMinutes(5); string _nd_confirm = current.ToString("ddMMyyyy HH:mm") + "_" + _user.Id; _nd_confirm = WebApps.CommonFunction.AppsCommon.EncryptString(_nd_confirm); //string key_EncryptString = WebApps.CommonFunction.AppsCommon.DecryptString(_nd_confirm); string link = Configuration.LinkPathlaw + "/vi-vn/quen-mat-khau/thong-bao?confirm=" + _nd_confirm; string language = AppsCommon.GetCurrentLang(); if (language != "VI_VN") { link = Configuration.LinkPathlaw + "/en-gb/quen-mat-khau/thong-bao?confirm=" + _nd_confirm; } string content = GetContentMail(link); Email_Info _Email_Info = new Email_Info { EmailFrom = EmailHelper.EmailOriginal.EMailFrom, Pass = EmailHelper.EmailOriginal.PassWord, Display_Name = EmailHelper.EmailOriginal.DisplayName, EmailTo = _user.Email, EmailCC = "", Subject = "Đặt lại mật khẩu", Content = content, LstAttachment = _LstAttachment, }; CommonFunction.AppsCommon.EnqueueSendEmail(_Email_Info); //_ck = EmailHelper.SendMail(_user.Email, "", "Đặt lại mật khẩu", content, _LstAttachment); return(Json(new { success = 1 })); } catch (Exception ex) { Logger.LogException(ex); } return(Json(new { success = _ck })); }
public ActionResult UpdateRepEmail(ContactInfo _contact) { decimal _ck = -1; try { decimal _status = 1; if (_contact.FileBase_File_Url != null) { _contact.URL = AppLoadHelpers.PushFileToServer(_contact.FileBase_File_Url, AppUpload.Search); } if (_contact.FileBase_File_Url02 != null) { _contact.URL01 = AppLoadHelpers.PushFileToServer(_contact.FileBase_File_Url02, AppUpload.Search); } Contact_BL _bl = new Contact_BL(); // update trạng thái phản hồi status = 1 và nội jdung phản hồi _ck = _bl.Contact_UpdateStatus(_contact.ID, _status, _contact.ReplyContent, _contact.ReplySubject, SessionData.CurrentUser.Username, _contact.URL, _contact.URL01); if (_ck > 0) { string _content = _contact.ReplyContent.Replace("\n", "<br><br>"); List <string> _LstAttachment = new List <string>(); if (_contact.URL != null) { _LstAttachment.Add(System.Web.HttpContext.Current.Server.MapPath(_contact.URL)); } if (_contact.URL01 != null) { _LstAttachment.Add(System.Web.HttpContext.Current.Server.MapPath(_contact.URL01)); } string content = AppsCommon.SetContentMailTemplate(_content, yourref: "", outref: _contact.Case_Code, dearname: _contact.ContactName); Email_Info _Email_Info = new Email_Info { EmailFrom = EmailHelper.EmailOriginal.EMailFrom_Business, Pass = EmailHelper.EmailOriginal.PassWord_Business, Display_Name = EmailHelper.EmailOriginal.DisplayName_Business, EmailTo = _contact.Email, EmailCC = "", Subject = _contact.ReplySubject, Content = content, LstAttachment = _LstAttachment, }; CommonFunction.AppsCommon.EnqueueSendEmail(_Email_Info); } } catch (Exception ex) { Logger.LogException(ex); } return(Json(new { status = _ck })); }
public ActionResult do_SendEmail(Email_Info pInfo) { try { List <string> _LstAttachment = new List <string>(); if (pInfo.File_Attach_1 != null) { var _url_File_Attach_1 = AppLoadHelpers.PushFileToServer(pInfo.File_Attach_1, AppUpload.App); _LstAttachment.Add(System.Web.HttpContext.Current.Server.MapPath(_url_File_Attach_1)); } if (pInfo.File_Attach_2 != null) { var _url_File_Attach_2 = AppLoadHelpers.PushFileToServer(pInfo.File_Attach_2, AppUpload.App); _LstAttachment.Add(System.Web.HttpContext.Current.Server.MapPath(_url_File_Attach_2)); } pInfo.LstAttachment = _LstAttachment; if (pInfo.EmailFrom == "*****@*****.**") { pInfo.EmailFrom = EmailHelper.EmailOriginal.EMailFrom_Business; pInfo.Pass = EmailHelper.EmailOriginal.PassWord_Business; pInfo.Display_Name = EmailHelper.EmailOriginal.DisplayName_Business; } else { pInfo.EmailFrom = EmailHelper.EmailOriginal.EMailFrom; pInfo.Pass = EmailHelper.EmailOriginal.PassWord; pInfo.Display_Name = EmailHelper.EmailOriginal.DisplayName; } string _content = pInfo.Content.Replace("<br />", "<br /><br />"); //.Replace("\n", "<br><br>"); _content = AppsCommon.SetContentMailTemplate(_content, yourref: pInfo.Your_Ref, outref: pInfo.Out_Ref, dearname: pInfo.Customer_Name, p_namereply: pInfo.Sign, p_position_name: pInfo.Position); pInfo.Content = _content; pInfo.Created_by = SessionData.CurrentUser.Username; CommonFunction.AppsCommon.EnqueueSendEmail(pInfo); return(Json(new { success = 1 })); } catch (Exception ex) { Logger.LogException(ex); return(Json(new { success = "-1" })); } }
public decimal Send_Email_Insert(Email_Info info) { try { EmailDA emailDA = new EmailDA(); return(emailDA.Send_Email_Insert(info.EmailFrom, info.EmailTo, info.EmailCC, info.Display_Name, info.Subject, info.Content, info.LstAttachment, info.Status, info.Send_Time, info.Created_by)); } catch (Exception ex) { Logger.LogException(ex); return(-1); } }
public ActionResult GetView2View(decimal id, string case_code) { try { Email_BL _obj_bl = new Email_BL(); Email_Info _Email_Info = _obj_bl.Email_GetBy_Id(id, case_code, AppsCommon.GetCurrentLang()); ViewBag.Email_Info = _Email_Info; } catch (Exception ex) { Logger.LogException(ex); } return(PartialView("~/Areas/Manager/Views/Email/_PartialView.cshtml")); }
public ActionResult XacNhanKhachHangDK(decimal pID, string pEmail) { var lstUsers = new List <RegisterInfo>(); try { string _pass = CommonFunction.AppsCommon.CreateRandomString(10); var passwordEncrypt = Encription.EncryptAccountPassword(pEmail, _pass); UserBL objBL = new UserBL(); RegisterInfo pInfo = new RegisterInfo(); pInfo.Id = pID; pInfo.Modifiedby = SessionData.CurrentUser.Username; pInfo.ModifiedDate = SessionData.CurrentUser.CurrentDate; pInfo.KeySecret = passwordEncrypt; pInfo.Status = 1; int preturn = objBL.RegisterUpdate(pInfo); if (preturn >= 0) { Email_Info _Email_Info = new Email_Info { EmailFrom = EmailHelper.EmailOriginal.EMailFrom, Pass = EmailHelper.EmailOriginal.PassWord, Display_Name = EmailHelper.EmailOriginal.DisplayName, EmailTo = pEmail, EmailCC = "", Subject = "Email thông báo đăng ký mở tài khoản thành công", Content = "Dear Customer, Quí khách đăng ký thành công tài khoản username:"******" password:"******"\n quí khách vui lòng truy cập vào địa chỉ <a href='http://pathlaw.net/vi-vn/account/login'>http://pathlaw.net/vi-vn/account/login</a> để đổi mật khẩu của tài khoản. \n cảm ơn quí khách hàng. ", LstAttachment = new List <string>(), }; CommonFunction.AppsCommon.EnqueueSendEmail(_Email_Info); //EmailHelper.SendMail(pEmail, "", "Email thông báo đăng ký mở tài khoản thành công", "Dear Customer, Quí khách đăng ký thành công tài khoản username:"******" password:"******"\n quí khách vui lòng truy cập vào địa chỉ <a href='http://pathlaw.net/vi-vn/account/login'>http://pathlaw.net/vi-vn/account/login</a> để đổi mật khẩu của tài khoản. \n cảm ơn quí khách hàng. ", new List<string>()); } return(Json(new { status = preturn })); } catch (Exception ex) { Logger.LogException(ex); return(Json(new { status = -3 })); } }
void ThreadSendEmail() { while (true) { try { Email_Info _Email_Info = WebApps.CommonFunction.AppsCommon.Dequeue_SendEmail(); if (_Email_Info != null) { _Email_Info.Send_Time = DateTime.Now; bool _ck = EmailHelper.SendMail(_Email_Info.EmailFrom, _Email_Info.Pass, _Email_Info.Display_Name, _Email_Info.EmailTo, _Email_Info.EmailCC, _Email_Info.Subject, _Email_Info.Content, _Email_Info.LstAttachment); if (_ck == false) { WebApps.CommonFunction.AppsCommon.EnqueueSendEmail(_Email_Info); _Email_Info.Status = "E"; } else { _Email_Info.Status = "S"; } Email_BL _bl = new Email_BL(); if (_Email_Info.Created_by == null || _Email_Info.Created_by == "") { _Email_Info.Created_by = "System"; } _bl.Send_Email_Insert(_Email_Info); } Thread.Sleep(1000); } catch (Exception ex) { Thread.Sleep(2000); Logger.Log().Error(ex.ToString()); } } }
public ActionResult DoAdminConfirm(string p_case_code, decimal p_status, string p_note) { try { SearchObject_BL _con = new SearchObject_BL(); decimal _ck = _con.Admin_Update(p_case_code, p_status, p_note, AppsCommon.GetCurrentLang(), SessionData.CurrentUser.Username); // nếu thành công thì gửi email cho khách hàng if (_ck != -1 && p_status == (decimal)CommonSearch.Stt_DaPhanHoi) { // lấy thông tin search SearchObject_BL _searchBL = new SearchObject_BL(); List <SearchObject_Detail_Info> _ListDetail = new List <SearchObject_Detail_Info>(); SearchObject_Question_Info _QuestionInfo = new SearchObject_Question_Info(); List <AppClassDetailInfo> search_Class_Infos = new List <AppClassDetailInfo>(); SearchObject_Header_Info _HeaderInfo = _searchBL.SEARCH_HEADER_GETBY_CASECODE(p_case_code, ref _ListDetail, ref _QuestionInfo, ref search_Class_Infos); // lấy thông tin người dùng UserBL _UserBL = new UserBL(); UserInfo userInfo = _UserBL.GetUserByUsername(_HeaderInfo.CREATED_BY.Trim()); #region Bỏ đi vì đã có trong email //string _fileTemp = System.Web.HttpContext.Current.Server.MapPath("/Content/Report/Search Report.doc"); //if (_HeaderInfo.Customer_Country != Common.Common.Country_VietNam_Id) // _fileTemp = System.Web.HttpContext.Current.Server.MapPath("/Content/Report/Search Report_En.doc"); //DocumentModel document = DocumentModel.Load(_fileTemp); //// Fill export_header //string fileName = System.Web.HttpContext.Current.Server.MapPath("/Content/Export/" + "Search_report" + p_case_code.ToString() + ".pdf"); //document.MailMerge.FieldMerging += (sender, e) => //{ // if (e.IsValueFound) // { // if (e.FieldName == "Text") // ((Run)e.Inline).Text = e.Value.ToString(); // } //}; //string _search_type = ""; //if (_ListDetail.Count > 0) //{ // _search_type = _ListDetail[0].SEARCH_TYPE_NAME; //} //document.MailMerge.Execute(new { DateNo = DateTime.Now.ToString("dd-MM-yyyy") }); //document.MailMerge.Execute(new { Case_Name = _HeaderInfo.CASE_NAME }); //document.MailMerge.Execute(new { Client_Reference = _HeaderInfo.CLIENT_REFERENCE }); //document.MailMerge.Execute(new { Case_Code = _HeaderInfo.CASE_CODE }); //document.MailMerge.Execute(new { Applicant_Name = _HeaderInfo.Customer_Name }); //document.MailMerge.Execute(new { Customer_Country_Name = _HeaderInfo.Customer_Country_Name }); //document.MailMerge.Execute(new { Object = _HeaderInfo.Object_Search_Name }); //document.MailMerge.Execute(new { Result = _QuestionInfo.RESULT }); //document.MailMerge.Execute(new { Search_Type = _search_type }); //if (userInfo != null) //{ // document.MailMerge.Execute(new { Contact_Person = userInfo.Contact_Person }); // document.MailMerge.Execute(new { Address = userInfo.Address }); // document.MailMerge.Execute(new { FullName = userInfo.FullName }); //} //else //{ // document.MailMerge.Execute(new { Contact_Person = "" }); // document.MailMerge.Execute(new { Address = "" }); // document.MailMerge.Execute(new { FullName = "" }); //} //document.Save(fileName, SaveOptions.PdfDefault); //byte[] fileContents; //var options = SaveOptions.PdfDefault; //// Save document to DOCX format in byte array. //using (var stream = new MemoryStream()) //{ // document.Save(stream, options); // fileContents = stream.ToArray(); //} //Convert.ToBase64String(fileContents); #endregion string _emailTo = userInfo.Email; string _emailCC = ""; //string _emailCC = userInfo.Copyto; List <string> _LstAttachment = new List <string>(); //20190812 bỏ đi vì đã gửi trong email rồi //_LstAttachment.Add(fileName); if (_QuestionInfo.FILE_URL != null && _QuestionInfo.FILE_URL != "") { _LstAttachment.Add(System.Web.HttpContext.Current.Server.MapPath(_QuestionInfo.FILE_URL)); } if (_QuestionInfo.FILE_URL02 != null && _QuestionInfo.FILE_URL02 != "") { _LstAttachment.Add(System.Web.HttpContext.Current.Server.MapPath(_QuestionInfo.FILE_URL02)); } if (_HeaderInfo.Billing_Id > 0) { // lấy thông tin billing Billing_BL _Billing_BL = new Billing_BL(); Billing_Header_Info _Billing_Header_Info = _Billing_BL.Billing_GetBy_Id(_HeaderInfo.Billing_Id, AppsCommon.GetCurrentLang()); if (_Billing_Header_Info.Billing_Id > 0 && _Billing_Header_Info.Status == (decimal)CommonEnums.Billing_Status.Approved) { //_LstAttachment.Add(System.Web.HttpContext.Current.Server.MapPath(_HeaderInfo.Url_Billing)); // kết xuất thông tin string _mapPath_Report = Server.MapPath("~/Report/"); string _mapPath = Server.MapPath("~/"); string _fileName = AppsCommon.Export_Billing_Crytal_View(_Billing_Header_Info.Case_Code, _mapPath_Report, _mapPath); _LstAttachment.Add(System.Web.HttpContext.Current.Server.MapPath(_fileName)); } } string _content = _QuestionInfo.RESULT.Replace("\n", "<br><br>"); _content = AppsCommon.SetContentMailTemplate(_content, yourref: _QuestionInfo.CLIENT_REFERENCE, outref: p_case_code, dearname: userInfo.Username); Email_Info _Email_Info = new Email_Info { EmailFrom = EmailHelper.EmailOriginal.EMailFrom_Business, Pass = EmailHelper.EmailOriginal.PassWord_Business, Display_Name = EmailHelper.EmailOriginal.DisplayName_Business, EmailTo = _emailTo, EmailCC = _emailCC, Subject = "Search Report", Content = _content, LstAttachment = _LstAttachment, }; CommonFunction.AppsCommon.EnqueueSendEmail(_Email_Info); } return(Json(new { success = _ck })); } catch (Exception ex) { Logger.LogException(ex); return(Json(new { success = "-1" })); } }
private void ThreadReadTodo4SendEmail() { int _timeSleep = Convert.ToInt16(CommonFuc.GetConfig("TimeSleepSendMail")); while (true) { try { //if (DateTime.Now.ToString("HH:mm") == "00:55" && Common.c_is_call_change_remind == false) //{ // B_Remind_BL _bl = new B_Remind_BL(); // _bl.Auto_change_remind(); // Logger.Log().Info("ChangeRemind " + DateTime.Now.ToString("dd/MM/yyyy")); // Common.c_is_call_change_remind = true; //} //else if (DateTime.Now.ToString("HH:mm") != "00:55") //{ // Common.c_is_call_change_remind = false; //} // đọc thông tin cần gửi email B_Todos_BL _B_Todos_BL = new B_Todos_BL(); List <B_Todos_Info> _lst = _B_Todos_BL.GetSend_Email(); List <string> _LstAttachment = new List <string>(); List <B_Todos_Info> _lst_update = new List <B_Todos_Info>(); foreach (B_Todos_Info item in _lst) { Email_Info _Email_Info = new Email_Info { EmailFrom = EmailHelper.EmailOriginal.EMailFrom, Pass = EmailHelper.EmailOriginal.PassWord, Display_Name = EmailHelper.EmailOriginal.DisplayName, EmailTo = item.Email_Send, EmailCC = "", Subject = item.Subject, Content = item.CONTENT, LstAttachment = _LstAttachment, }; CommonFunction.AppsCommon.EnqueueSendEmail(_Email_Info); // update todo-id _lst_update.Add(item); Thread.Sleep(_timeSleep); } // update todo-id if (_lst_update.Count > 0) { _B_Todos_BL.Update_Todo_Email(_lst_update); } Thread.Sleep(10000); } catch (Exception ex) { Thread.Sleep(2000); Logger.Log().Error(ex.ToString()); } } }