public int NotificationRecommendAttendance(AttendanceRequestDTO atd) { EmployeeDetailsViewModel user = _employeeService.GetEmployeeDetails(atd.RequestEmpCode); EmployeeDetailsViewModel recomend = _employeeService.GetEmployeeDetails(Convert.ToInt32(atd.RecommendarEmpCode)); EmployeeDetailsViewModel approver = _employeeService.GetEmployeeDetails(Convert.ToInt32(atd.ApproverEmpCode)); if (atd.RecommendStatus == 2) { #region NotificationUser NotificationsDTOs ntd = new NotificationsDTOs(); ntd.NotificationDate = DateTime.Now; ntd.NotificationReceiverId = Convert.ToInt32(atd.RequestEmpCode); ntd.NotificationSubject = "Recommender approve your Attendnace"; ntd.NotificationMessage = "Your attendnace request on " + atd.RequestedDate + " is Recommended by " + recomend.Name; ntd.NotificationReceiverType = "E"; ntd.NotificationDetailURL = "/user/attendancerequest/AttendanceDetail/" + atd.RequestId; ntd.NotificationReadDate = null; _notifications.InsertNotification(ntd); #endregion #region Notificationapprover NotificationsDTOs ntf = new NotificationsDTOs(); ntf.NotificationDate = DateTime.Now; ntf.NotificationReceiverId = approver.Code; ntf.NotificationSubject = "Attendnace Requested to approve"; ntf.NotificationMessage = user.Name + " Slected you as Approver as this request is already been recommened by " + recomend.Name + ".Please confirm the request "; ntf.NotificationReceiverType = "E"; ntf.NotificationDetailURL = "/user/attendancerequest/recommend/" + atd.RequestId; ntf.NotificationReadDate = null; _notifications.InsertNotification(ntf); #endregion #region Emailapprover string emailTypeapprover = "Email"; EmailServices.Message mgs_r = new EmailServices.Message(); htmlReader reader_r = new htmlReader(); List <string> receiver = new List <string>() { approver.Email }; mgs_r.Subject = "Attendnace request for Approve "; EmailTemplateModel emailTemplateData = new EmailTemplateModel() { UserName = approver.Name, Descriptions = user.Name + " has request attendance for" + atd.RequestType + " on " + atd.RequestedDate + ". Please confirm the request as this request is already been recommended by " + recomend.Name + " on " + DateTime.Now + " Please follow the link below for more detail.", FullName = recomend.Name, Title = "Attendance Request for approve", Url = baseUrl + "/user/attendancerequest/approved/" + atd.RequestId.ToString() }; mgs_r.Body = reader_r.GetHtmlBodyTemplate(emailTemplateData, emailTypeapprover); EmailServices.Notify(receiver, mgs_r); #endregion } else if (atd.RecommendStatus == 3) { #region NotificationUser NotificationsDTOs ntd = new NotificationsDTOs(); ntd.NotificationDate = DateTime.Now; ntd.NotificationReceiverId = Convert.ToInt32(user.Code); ntd.NotificationSubject = "Attendance request rejected by " + recomend.Name; ntd.NotificationMessage = "Sorry!! Your attendnace request on " + atd.RequestedDate + " is rejected by " + recomend.Name; ntd.NotificationReceiverType = "E"; ntd.NotificationDetailURL = "/user/attendancerequest/AttendanceDetail/" + atd.RequestId; ntd.NotificationReadDate = null; _notifications.InsertNotification(ntd); #endregion } #region Emailuser string emailType = "Email"; EmailServices.Message msg = new EmailServices.Message(); htmlReader reader = new htmlReader(); List <string> recipient = new List <string>() { user.Email }; if (atd.RecommendStatus == 2) { msg.Subject = "Recommender for Attendnace request"; EmailTemplateModel emailTemplateData = new EmailTemplateModel() { UserName = user.Name, Descriptions = "Attendance you requested on " + atd.RequestedDate + " for " + atd.RequestType + " has been accepted by " + recomend.Name + " on " + DateTime.Now + ". Please visit the link below for details", FullName = recomend.Name, Title = "Recommend Attendance Request", Url = baseUrl + "user/attendancerequest/AttendanceDetail/" + atd.RequestId.ToString() }; msg.Body = reader.GetHtmlBodyTemplate(emailTemplateData, emailType); EmailServices.Notify(recipient, msg); } else if (atd.RecommendStatus == 3) { msg.Subject = "Attendance request rejected by Recommender"; EmailTemplateModel emailTemplateData = new EmailTemplateModel() { UserName = user.Name, Descriptions = "Attendance you requested on " + atd.RequestedDate + " for " + atd.RequestType + " has been rejected by " + recomend.Name + " on " + DateTime.Now + ". Please visit the link below for details", FullName = recomend.Name, Title = "Recommend Attendance Request", Url = baseUrl + "user/attendancerequest/AttendanceDetail/" + atd.RequestId.ToString() }; msg.Body = reader.GetHtmlBodyTemplate(emailTemplateData, emailType); EmailServices.Notify(recipient, msg); } #endregion return(0); }
public bool IsValid() => EmailServices.IsValid(Email);
public void Execute(IJobExecutionContext context) { EmailServices.SendEmails(20); }
public bool IsValid() { return(EmailServices.IsValid(Email) && CPFServices.IsValid(CPF)); }
public FeedbackController(EmailServices emailService) { this.emailService = emailService; }
public async Task <ActionResult> GetClaimEmails(string claimId, string filterText) { EmailServices emailService = new EmailServices(); return(Json(await emailService.GetAllClaimEmails(claimId, filterText), JsonRequestBehavior.AllowGet)); }
protected void OnCommand(object sender, CommandEventArgs e) { //Event handler for cancel button clicked switch (e.CommandName) { case "Close": Response.Redirect("~/Members/Default.aspx", true); break; case "Reject": bool deleted = false, sent = false; try { deleted = Membership.DeleteUser(this.cboGuest.SelectedValue, true); if (deleted) { if (this.txtComments.Text.Trim().Length > 0) { sent = new EmailServices().SendRejectRegistrationMessage(this.txtUserID.Text, this.txtEmail.Text, this.txtComments.Text); } Master.ShowMsgBox(this.txtUserID.Text + " has been deleted" + (sent ? " and a rejection email has been sent." : ".")); } else { Master.ShowMsgBox(this.txtUserID.Text + " has not been deleted."); } } catch (Exception ex) { string msg = this.txtUserID.Text + (deleted ? " has been deleted but an unexpected error occurred." : " has not been deleted and an unexpected error occurred."); Master.ReportError(new ApplicationException(msg, ex)); } finally { //this.cboGuest.DataBind(); refreshGuestList(); if (this.cboGuest.Items.Count > 0) { this.cboGuest.SelectedIndex = 0; } OnGuestChanged(null, EventArgs.Empty); } break; case "Approve": try { MembershipUser user = Membership.GetUser(this.cboGuest.SelectedValue); ProfileCommon profile = Profile.GetProfile(user.UserName); profile.UserFullName = this.txtUserName.Text; profile.Company = this.cboCustomer.SelectedItem.Text; profile.WebServiceUser = false; profile.Type = this.cboType.SelectedValue.ToLower(); profile.ClientVendorID = this.cboCustomer.SelectedValue; profile.Save(); Roles.RemoveUserFromRole(user.UserName, MembershipServices.GUESTROLE); Roles.AddUserToRole(user.UserName, MembershipServices.TRACKINGROLE); user.Email = this.txtEmail.Text; user.IsApproved = true; Membership.UpdateUser(user); new EmailServices().SendWelcomeMessage(profile.UserFullName, this.cboGuest.SelectedValue, user.Email); Master.ShowMsgBox(this.txtUserID.Text + " has been approved and a welcome email has been sent."); } catch (Exception ex) { string msg = "An unexpected error occurred while approving " + this.txtUserID.Text + "."; Master.ReportError(new ApplicationException(msg, ex)); } finally { //this.cboGuest.DataBind(); refreshGuestList(); if (this.cboGuest.Items.Count > 0) { this.cboGuest.SelectedIndex = 0; } OnGuestChanged(null, EventArgs.Empty); } break; } }
public AuthenticationController(ILogger <AuthenticationController> logger, UserServices userServices, IConfiguration config, UserRepository userRepository, EmailServices emailServices) { _logger = logger; _configuration = config; _userRepository = userRepository; _emailServices = emailServices; _userServices = userServices; }
public TestsEmailServices() { service = new EmailServices(this.TContext); }
public void Start(bool AsService) { try { m_AppData.RunninAsService = AsService; ////////////////////////////////////// // // setup system wide health statistics m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.System.System_Drive].StatString.RegisterForUse(true); m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.System.System_frameGrabber_2].StatString.RegisterForUse(true); m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.System.System_frameGrabber_1].StatString.RegisterForUse(true); m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.System.System_GPS].StatString.RegisterForUse(true); m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.System.System_Hotswap].StatString.RegisterForUse(true); m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.System.System_Service].StatString.RegisterForUse(true); m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.System.System_videoChannel1].StatString.RegisterForUse(true); m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.System.System_videoChannel2].StatString.RegisterForUse(true); m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.System.System_videoChannel3].StatString.RegisterForUse(true); m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.System.System_videoChannel4].StatString.RegisterForUse(true); m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.QueueOverruns.QueueOverruns_DVR_DirectyToStorageQ].Accumulator.RegisterForUse(true); m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.QueueOverruns.QueueOverruns_DVR_MotionDetectedQ].Accumulator.RegisterForUse(true); m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.QueueOverruns.QueueOverruns_DVR_NewFrameQ].Accumulator.RegisterForUse(true); m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.QueueOverruns.QueueOverruns_DVR_NewLPRRecordQ].Accumulator.RegisterForUse(true); m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.QueueOverruns.QueueOverruns_FG_AllFramesConsumerPushQ].Accumulator.RegisterForUse(true); m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.QueueOverruns.QueueOverruns_FG_MotionDetectedConsumerPushQ].Accumulator.RegisterForUse(true); m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.QueueOverruns.QueueOverruns_FG_MotionDetectionQ].Accumulator.RegisterForUse(true); m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.QueueOverruns.QueueOverruns_LPR_LPRFinalPlateGroupOutputQ].Accumulator.RegisterForUse(true); m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.QueueOverruns.QueueOverruns_LPR_LPRPerFrameReadingQ].Accumulator.RegisterForUse(true); m_AppData.HealthStatistics[(int)APPLICATION_DATA.HEALTH_STATISTICS.QueueOverruns.QueueOverruns_LPR_LPRProcessQ].Accumulator.RegisterForUse(true); ////////////////////////////////////// // // start error reporting lib ( decides if local and/or remote reporting) m_AppData.Logger = new ErrorLog(m_AppData); m_Log = (ErrorLog)m_AppData.Logger; m_Log.Log("Starting LPR Services", ErrorLog.LOG_TYPE.INFORMATIONAL); m_Log.Log("using file in path: " + UserSettings.GetAppPath(), ErrorLog.LOG_TYPE.INFORMATIONAL); ////////////////////////////////////// // // start email lib (used by error reporting lib for remote error notifications and by the watch list processor) m_Log.Log("Loading Email module", ErrorLog.LOG_TYPE.INFORMATIONAL); m_AppData.EmailServices = new EmailServices(m_AppData); m_Email = (EmailServices)m_AppData.EmailServices; ////////////////////////////////////// // // load the Frame Generator m_Log.Log("Loading Frame Generator module", ErrorLog.LOG_TYPE.INFORMATIONAL); m_AppData.FrameGenerator = (object)new FrameGenerator(m_AppData, AsService); ////////////////////////////////////// // // load the DVR m_AppData.DVRMode = APPLICATION_DATA.DVR_MODE.STORE_ON_MOTION; m_Log.Log("Loading DVR module", ErrorLog.LOG_TYPE.INFORMATIONAL); m_DVR = new DVR(m_AppData); m_AppData.DVR = (object)m_DVR; ////////////////////////////////////// // // start the TCP Server if (m_AppData.RunninAsService) { m_Log.Log("Loading TCP module", ErrorLog.LOG_TYPE.INFORMATIONAL); m_RCServer = new RemoteConnectionServer.RemoteConnectionServer(m_AppData); } ////////////////////////////////////// // // load the LPR Engine m_Log.Log("Loading LPR Engine", ErrorLog.LOG_TYPE.INFORMATIONAL); m_LPREngine = new LPREngine(m_AppData); m_AppData.LPREngine = m_LPREngine; ////////////////////////////////////// // // load the Watch List Processor m_Log.Log("Loading Watch List module", ErrorLog.LOG_TYPE.INFORMATIONAL); m_WatchList = new WatchLists(m_AppData); // now that all modules are loaded, let them register with each other for event communications m_Log.Log("Starting registrations", ErrorLog.LOG_TYPE.INFORMATIONAL); if (m_AppData.RunninAsService) { m_RCServer.StartRegistration(); } m_DVR.StartRegistration(); m_LPREngine.StartRegistration(); m_WatchList.StartRegistration(); // now let all modules start their threads if (m_AppData.RunninAsService) { m_Log.Log("Starting TCP Server", ErrorLog.LOG_TYPE.INFORMATIONAL); m_RCServer.StartThreads(); } m_Log.Log("Starting DVR", ErrorLog.LOG_TYPE.INFORMATIONAL); m_DVR.StartThreads(); m_Log.Log("Starting LPR Engine", ErrorLog.LOG_TYPE.INFORMATIONAL); m_LPREngine.StartThreads(); m_Log.Log("Starting Watch list processor", ErrorLog.LOG_TYPE.INFORMATIONAL); m_WatchList.StartThreads(); m_Log.Log("Starting Email Services", ErrorLog.LOG_TYPE.INFORMATIONAL); m_Email.StartThreads(); // is everyone happy? //if (!m_DVR.GetDVRReady || !((FrameGenerator)m_AppData.FrameGenerator).GetReadyStatus) //{ // m_Log.Log("Error, self destruct", ErrorLog.LOG_TYPE.FATAL); // m_AppData.SelfDestruct(); //} } catch (Exception ex) { m_Log.Trace(ex, ErrorLog.LOG_TYPE.FATAL); } }
public EmailHistoryInfoAppService(FangHuaHostDbContext context) { _context = context; _emailServices = new EmailServices(); }
protected void OnPODRequest(object sender, EventArgs e) { //Send request to Customer Service and confirmation to user TrackingDS.CartonDetailTableRow carton = null; string cbol = ""; bool imageFound = false; MembershipServices membership = new MembershipServices(); TrackingDS summary = (TrackingDS)Session["TrackingSummary"]; TrackingDS.CartonSummaryTableRow summaryRow = summary.CartonSummaryTable.FindByID(this.CartonNumberValue.Text); if (summaryRow == null) { summaryRow = summary.CartonSummaryTable.FindByID(this.LabelSeqValue.Text); } if (summaryRow != null) { //Get all detail rows for this carton string filter = "[LBL]=" + summaryRow.LBLNumber; TrackingDS cartons = (TrackingDS)Session["TrackingDetail"]; DataRow[] detailRows = cartons.CartonDetailTable.Select(filter); if (detailRows != null && detailRows.Length > 0) { //Get carton data carton = (TrackingDS.CartonDetailTableRow)detailRows[0]; if (membership.IsAdmin || membership.IsArgix || membership.IsPODMember) { //Check for a POD image for this CBOL cbol = carton.IsCBOLNull() ? "" : carton.CBOL.Trim(); if (cbol.Length > 0) { string cl = carton.CL.Trim().PadLeft(3, '0'); string div = "%"; string st = carton.S.ToString().PadLeft(5, '0'); Imaging.ImageService isvc = new Imaging.ImageService(); isvc.Url = Application["ImageService"].ToString(); isvc.UseDefaultCredentials = true; DataSet ds = isvc.SearchSharePointImageStore("TBill", "TBBarCode", cbol + cl + div + st + "%"); imageFound = (ds != null && ds.Tables[0].Rows.Count > 0); } } } } if (imageFound) { //Image available- open image into another browser instance System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append("<script language=javascript>"); sb.Append("window.open('PODImage.aspx?doc=TBill&prop=TBBarCode&search=" + cbol + "%', '_blank', 'width=480,height=576,menubar=yes,location=no,toolbar=no,status=yes,resizable=yes');"); sb.Append("</script>"); Page.ClientScript.RegisterStartupScript(typeof(Page), "POD Image", sb.ToString()); } else { //No image; request a POD from Argix EmailServices svcs = new EmailServices(); MembershipUser user = Membership.GetUser(); string substore = Session["SubStore"] != null ? Session["SubStore"].ToString() : ""; svcs.SendPODRequest(user, carton, substore); svcs.SendPODRequestConfirm(user, carton, substore); //Disply confirmation to user Response.Redirect("PODConfirmation.aspx"); } }
public CustomerController(AccountManager accountManager, EmailServices emailService) { this.accountManager = accountManager; this.emailService = emailService; }
public int NotificationApproveAttendance(AttendanceRequestDTO atd) { EmployeeDetailsViewModel user = _employeeService.GetEmployeeDetails(atd.RequestEmpCode); EmployeeDetailsViewModel recomend = _employeeService.GetEmployeeDetails(Convert.ToInt32(atd.RecommendarEmpCode)); EmployeeDetailsViewModel approver = _employeeService.GetEmployeeDetails(Convert.ToInt32(atd.ApproverEmpCode)); if (atd.ApproveStatus == 2) { #region NotificationUser NotificationsDTOs ntd = new NotificationsDTOs(); ntd.NotificationDate = DateTime.Now; ntd.NotificationReceiverId = Convert.ToInt32(user.Code); ntd.NotificationSubject = "Approver approve your Attendnace"; ntd.NotificationMessage = "Attendance you requested on " + atd.RequestedDate + " is Approved by " + approver.Name; ntd.NotificationReceiverType = "E"; ntd.NotificationDetailURL = "/user/attendancerequest/AttendanceDetail/" + atd.RequestId; ntd.NotificationReadDate = null; _notifications.InsertNotification(ntd); #endregion #region Notificationrecommender NotificationsDTOs ntf = new NotificationsDTOs(); ntf.NotificationDate = DateTime.Now; ntf.NotificationReceiverId = recomend.Code; ntf.NotificationSubject = "Approved attendance request"; ntf.NotificationMessage = "Attendance requested by" + user.Name + " on " + atd.RequestedDate + "is aproved by" + approver.Name; ntf.NotificationReceiverType = "E"; ntf.NotificationDetailURL = "/user/attendancerequest/recommend/" + atd.RequestId; ntf.NotificationReadDate = null; _notifications.InsertNotification(ntf); #endregion } else if (atd.ApproveStatus == 3) { #region NotificationUser NotificationsDTOs ntd = new NotificationsDTOs(); ntd.NotificationDate = DateTime.Now; ntd.NotificationReceiverId = Convert.ToInt32(user.Code); ntd.NotificationSubject = "Approver reject your Attendnace request"; ntd.NotificationMessage = "Attendance requested by" + user.Name + " on " + atd.RequestedDate + "is rejected by" + approver.Name; ntd.NotificationReceiverType = "E"; ntd.NotificationDetailURL = "/user/attendancerequest/AttendanceDetail/" + atd.RequestId; ntd.NotificationReadDate = null; _notifications.InsertNotification(ntd); #endregion #region Notificationrecommender NotificationsDTOs ntf = new NotificationsDTOs(); ntf.NotificationDate = DateTime.Now; ntf.NotificationReceiverId = recomend.Code; ntf.NotificationSubject = "Approver Rejected attendance request of " + user.Name; ntf.NotificationMessage = "Attendance requested for " + atd.RequestType + "requested on " + atd.RequestedDate + " is rejected by" + approver.Name; ntf.NotificationReceiverType = "E"; ntf.NotificationDetailURL = "/user/attendancerequest/recommend/" + atd.RequestId; ntf.NotificationReadDate = null; _notifications.InsertNotification(ntf); #endregion } #region Emailuser string emailType = "Email"; EmailServices.Message msg = new EmailServices.Message(); htmlReader reader = new htmlReader(); List <string> recipient = new List <string>() { user.Email }; if (atd.ApproveStatus == 2) { msg.Subject = "Approver confirm Attendnace request"; EmailTemplateModel emailTemplateData = new EmailTemplateModel() { UserName = user.Name, Descriptions = "Attendance requested on " + atd.RequestedDate + " for " + atd.RequestType + " is approved by " + approver.Name + " for more detail follow the link below", FullName = recomend.Name, Title = "Approver confirm Attendnace request for " + atd.RequestType, Url = baseUrl + "user/attendancerequest/AttendanceDetail/" + atd.RequestId.ToString() }; msg.Body = reader.GetHtmlBodyTemplate(emailTemplateData, emailType); EmailServices.Notify(recipient, msg); } else if (atd.ApproveStatus == 3) { msg.Subject = "Approver Rejected Attendnace request"; EmailTemplateModel emailTemplateData = new EmailTemplateModel() { UserName = user.Name, Descriptions = "Attendance requested on " + atd.RequestedDate + " for " + atd.RequestType + " is rejected by " + approver.Name + " for more detail follow the link below", FullName = recomend.Name, Title = "Rejected Attendnace request for " + atd.RequestType, Url = baseUrl + "/user/attendancerequest/AttendanceDetail/" + atd.RequestId.ToString() }; msg.Body = reader.GetHtmlBodyTemplate(emailTemplateData, emailType); EmailServices.Notify(recipient, msg); } #endregion #region Emailapprover string emailTypeapprover = "Email"; EmailServices.Message msgapprover = new EmailServices.Message(); htmlReader readerapprover = new htmlReader(); List <string> listapprover = new List <string>() { recomend.Email }; if (atd.RecommendStatus == 2) { msg.Subject = "Attendnace request approved of " + user.Name; EmailTemplateModel emailTemplateData = new EmailTemplateModel() { UserName = user.Name, Descriptions = "Attendnace you recommended on " + atd.RecommendStatusDate + " of " + user.Name + " is aproved by " + approver.Name + " on " + DateTime.Now + ". Please visit link below for details", FullName = recomend.Name, Title = "Attendnace request of " + user.Name + " for " + atd.RequestType + " is approved ", Url = baseUrl + "/user/attendancerequest/recommend/" + atd.RequestId.ToString() }; msg.Body = reader.GetHtmlBodyTemplate(emailTemplateData, emailTypeapprover); EmailServices.Notify(listapprover, msgapprover); } else if (atd.RecommendStatus == 3) { msg.Subject = " Attendnace request rejected of " + user.Name; EmailTemplateModel emailTemplateData = new EmailTemplateModel() { UserName = recomend.Name, Descriptions = "Attendnace you recommended on " + atd.RecommendStatusDate + " of " + user.Name + " is rejected by " + approver.Name + " on " + DateTime.Now + ". Please visit link below for details", FullName = recomend.Name, Title = "Attendnace request of " + user.Name + " for " + atd.RequestType + " is approved ", Url = baseUrl + "/user/attendancerequest/recommend/" + atd.RequestId.ToString() }; msg.Body = reader.GetHtmlBodyTemplate(emailTemplateData, emailTypeapprover); EmailServices.Notify(listapprover, msgapprover); } #endregion return(0); }
public AccountController() { _emailServices = new EmailServices(); }
public ConfigurePSSMainForm() { InitializeComponent(); try { this.Text = "First Evidence LPR Service Control, version " + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); m_AppData = new APPLICATION_DATA(); m_AppData.Logger = new ErrorLog(m_AppData, true); m_Log = (ErrorLog)m_AppData.Logger; SetConfigPath(); m_AppData.AddOnClosing(Stop, APPLICATION_DATA.CLOSE_ORDER.LAST); m_ConfigWatchListsUC = new ConfigWatchListsUC.ConfigWatchListsUC(m_AppData); m_EmailServices = new EmailServices(m_AppData); m_AppData.EmailServices = (object)m_EmailServices; m_EmailServices.StartThreads(); m_ConfigureEmailUC = new ConfigureEmailUC.ConfigureEmailUC(m_AppData); m_ConfigureGPS_UC = new ConfigureGPS_UC.ConfigureGPS_UC(); m_ConfigureGPS_UC.AppData = m_AppData; m_ConfigureGPS_UC.Location = new Point(50, 60); m_ConfigureSourceChannels = new ConfigureSourceChannels.ConfigSourceChannels(m_AppData); tabPageConfigureWatchLists.Controls.Add(m_ConfigWatchListsUC); tabPageConfigureEmail.Controls.Add(m_ConfigureEmailUC); tabPageConfigureGPS.Controls.Add(m_ConfigureGPS_UC); tabPageChannels.Controls.Add(m_ConfigureSourceChannels); this.FormClosing += new FormClosingEventHandler(ConfigurePSSMainForm_FormClosing); bool serviceInstalled = IsServiceInstalled(); ServiceControllerStatus status; bool serviceRunning = IsServiceRunning(out status); SetServiceStatus(serviceRunning, serviceInstalled); m_CheckServiceStatusThread = new Thread(CheckServiceStatusLoop); m_CheckServiceStatusThread.Start(); //////////// remove unwanted pages // get rid of the password and activationt tabs tabControlMain.TabPages.Remove(tabPageEnterPasswords); tabControlMain.TabPages.Remove(tabPageActivation); //if ( ActivateLicense.IsActivated()) //{ // tabControlMain.TabPages.Remove(tabPageActivation); //} } catch (Exception ex) { m_Log.Trace(ex, ErrorLog.LOG_TYPE.FATAL); } }
public AccountController(ApplicationUserManager userManager, ApplicationSignInManager signInManager) { UserManager = userManager; SignInManager = signInManager; _emailServices = new EmailServices(); }
public ActionResult CommissionRequest(CommissionRequestModel model) { model.CompetitorQuoteFile = Request.Files["CompetitorQuoteFile"]; model.CompetitorLineComparsionFile = Request.Files["CompetitorLineComparsionFile"]; model.CompetitorQuoteFileName = (model.CompetitorQuoteFile == null || model.CompetitorQuoteFile.FileName == "") ? model.CompetitorQuoteFileName : model.CompetitorQuoteFile.FileName; model.CompetitorLineComparsionFileName = (model.CompetitorLineComparsionFile == null || model.CompetitorLineComparsionFile.FileName == "") ? model.CompetitorLineComparsionFileName : model.CompetitorLineComparsionFile.FileName; model.OrderDeliveryDate = (model.Project == null) ? DateTime.Now : model.Project.EstimatedDelivery; List <string> emailsList = new List <string>(); if (model.EmailsList != null && model.EmailsList.Length > 0) { emailsList = model.EmailsList.ToString().Split(',', ';').ToList(); } EmailServices emailService = new EmailServices(); List <string> InvalidEmails = this.commissionRequestService.GetInvalidEmails(emailsList); if (InvalidEmails.Count > 0) { foreach (string email in InvalidEmails) { model.InvalidEmails.Add(email); } model.IsValidEmails = false; } // set the RequestedCommission equals to Approved Commission for Daikin Super User Testing Only if (model.RequestedCommissionTotal == 0) { model.RequestedCommissionTotal = model.ApprovedCommissionTotal; } this.ServiceResponse = commissionRequestService.PostModel(this.CurrentUser, model); if (ProcessServiceResponse(this.ServiceResponse)) { model.Project.EstimatedDelivery = model.OrderDeliveryDate; model.IsValidEmails = true; this.ServiceResponse = projectService.PostModel(this.CurrentUser, model.Project); var emailModel = this.commissionRequestService.GetCommissionRequestSendEmailModel(model); emailModel.HelpLink = "mailto:[email protected]"; emailModel.Subject = string.Format("A DPO Commission request has been submitted"); emailModel.From = new MailAddress(Utilities.Config("dpo.sys.email.commissionrequest"), "DPO Commission Request"); emailModel.To.Add(new MailAddress(Utilities.Config("dpo.sys.email.commissionrequest"), "Daikin Project Desk")); if (!string.IsNullOrEmpty(emailModel.AccountManagerEmail)) { emailModel.To.Add(new MailAddress(emailModel.AccountManagerEmail)); } if (!string.IsNullOrEmpty(emailModel.AccountOwnerEmail) && emailModel.AccountOwnerEmail != emailModel.AccountManagerEmail) { emailModel.To.Add(new MailAddress(emailModel.AccountOwnerEmail)); } if (model.ProjectOwnerId != null) { UserServices userService = new UserServices(); UserModel projectOwner = userService.GetUserModel(CurrentUser, model.ProjectOwnerId, true, true).Model as UserModel; if (projectOwner != null) { emailModel.To.Add(new MailAddress(projectOwner.Email)); } } else if (model.Project != null && model.Project.OwnerId != null) { UserServices userService = new UserServices(); UserModel projectOwner = userService.GetUserModel(CurrentUser, model.Project.OwnerId, true, true).Model as UserModel; if (projectOwner != null) { emailModel.To.Add(new MailAddress(projectOwner.Email)); } } foreach (string email in emailsList) { if (String.IsNullOrWhiteSpace(email)) { continue; } emailModel.To.Add(new MailAddress(email.Trim())); } emailModel.RenderTextVersion = true; emailModel.BodyTextVersion = RenderView(this, "SendEmailCommissionRequest", emailModel); emailModel.RenderTextVersion = false; emailModel.BodyHtmlVersion = RenderView(this, "SendEmailCommissionRequest", emailModel); new EmailServices().SendEmail(emailModel); //return RedirectToAction("QuoteItems", new QuoteModel { ProjectId = model.ProjectId, QuoteId = model.QuoteId }); string url = "/v2/#/quote/" + model.QuoteId + "/existingRecord"; return(Redirect(url)); } ModelState.Clear(); return(View("CommissionRequest", this.ServiceResponse.Model)); }
public ServiceResponse PostDiscountRequest(DiscountRequestModel model) { model.OrderDeliveryDate = model.Project.EstimatedDelivery; //Handle Emails List <string> emailsList = new List <string>(); if (model.EmailsList != null && model.EmailsList.Length > 0) { emailsList = model.EmailsList.ToString().Split(',', ';').ToList(); } EmailServices emailService = new EmailServices(); List <string> InvalidEmails = DiscountRequestService.GetInvalidEmails(emailsList); if (InvalidEmails.Count > 0) { foreach (string email in InvalidEmails) { model.InvalidEmails.Add(email); } model.IsValidEmails = false; } // set the RequestedDiscount equals to Approved Discount for Daikin Super User Testing Only // TODO: not sure what this is for ... //if (model.RequestedDiscount == 0) //{ // model.RequestedDiscount = model.ApprovedDiscount; //} this.ServiceResponse = DiscountRequestService.PostModel(this.CurrentUser, model); if (this.ServiceResponse.IsOK) { var response = ProjectService.PostModel(this.CurrentUser, model.Project); //=============Email============ var emailModel = DiscountRequestService.GetDiscountRequestSendEmailModel(model); //if (emailModel.discountRequest.RequestedDiscount == 0) //{ // var quoteModel = quoteService.GetQuoteModel(this.CurrentUser, model.ProjectId, model.QuoteId).Model as QuoteModel; // if (quoteModel != null) // { // emailModel.discountRequest.RequestedDiscount = quoteModel.DiscountPercentage * 100; // } //} emailModel.HelpLink = "mailto:[email protected]"; emailModel.Subject = string.Format("A DPO Discount request has been submitted"); emailModel.From = new MailAddress(Utilities.Config("dpo.sys.email.discountrequest"), "DPO Discount Request"); emailModel.To.Add(new MailAddress(Utilities.Config("dpo.sys.email.discountrequest"), "Daikin Project Desk")); //Add Account Manager - AccountOwner if (!string.IsNullOrEmpty(emailModel.AccountManagerEmail)) { emailModel.To.Add(new MailAddress(emailModel.AccountManagerEmail)); } if (!string.IsNullOrEmpty(emailModel.AccountOwnerEmail) && emailModel.AccountOwnerEmail != emailModel.AccountManagerEmail) { emailModel.To.Add(new MailAddress(emailModel.AccountOwnerEmail)); } //Add Project Owner if (model.ProjectOwnerId != null) { UserServices userService = new UserServices(); UserModel projectOwner = userService.GetUserModel(CurrentUser, model.ProjectOwnerId, true, true).Model as UserModel; if (projectOwner != null) { emailModel.To.Add(new MailAddress(projectOwner.Email)); } } //Add Email List foreach (string email in emailsList) { if (String.IsNullOrWhiteSpace(email)) { continue; } emailModel.To.Add(new MailAddress(email.Trim())); } //Render Email Body emailModel.RenderTextVersion = true; //emailModel.BodyTextVersion = RenderView(this, "SendEmailDiscountRequest", emailModel); emailModel.RenderTextVersion = false; //emailModel.BodyHtmlVersion = RenderView(this, "SendEmailDiscountRequest", emailModel); new EmailServices().SendEmail(emailModel); //Redirect to quote //string url = "/v2/#/quote/" + model.QuoteId + "/existingRecord"; //return Redirect(url); } return(this.ServiceResponse); }
private void SendMailtoForwaredUser() { string strFromEmail = ""; string strToEmail = ""; string strCCEmail = ""; List <string> strToEmails = new List <string>(); List <string> strCCEmails = new List <string>(); DataTable dtInquriyDetails = new DatabaseService().executeSelectQuery("SELECT * FROM Inquiry WHERE InquiryNumber = '" + lblInqNo.Text.ToString() + "'"); DataTable dtCusDetais = new DatabaseService().executeSelectQuery("SELECT * FROM Customer WHERE Id = '" + GetCusId(lblInqCus.Text.Trim()) + "'"); strFromEmail = GetEmail(GetEmpId(Views.frmHome.EmpName)); strToEmail = GetEmail(GetEmpId(lblInqForTo.Text.Trim())); strCCEmail = GetEmail(GetEmpId(lblInqForBy.Text.Trim())); StringBuilder strBuliderEmailSubject = new StringBuilder(); strBuliderEmailSubject.Append("Inquiry Forward Approved – Customer :" + lblInqCus.Text.Trim() + " " + " -Inquiry No :" + lblInqNo.Text.Trim() + " "); StringBuilder strBuliderEmailBody = new StringBuilder(); strBuliderEmailBody.Append("<head>"); strBuliderEmailBody.Append("<title>"); strBuliderEmailBody.Append(Guid.NewGuid().ToString()); strBuliderEmailBody.Append("</title>"); strBuliderEmailBody.Append("</head>"); strBuliderEmailBody.Append("<body>"); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append("Dear " + lblInqForTo.Text.Trim() + ","); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append("Inquiry <b><u><FONT COLOR=DodgerBlue>Forwarded</FONT></u></b>, pending for your Acceptance,"); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append(" <b>Inquiry No : </b>" + lblInqNo.Text.Trim() + ""); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append(" <b>Type : </b>" + lblInqType.Text.Trim() + ""); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append(" <b>Customer : </b>" + lblInqCus.Text.Trim() + ""); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append(" <b>Location : </b>" + GetSubLocationName(dtInquriyDetails.Rows[0]["Location"].ToString()) + ""); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append(" <b>Caller Name : </b>" + dtInquriyDetails.Rows[0]["CallerName"].ToString() + ""); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append(" <b>Caller Phone : </b>" + dtInquriyDetails.Rows[0]["CallerPhone"].ToString() + ""); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append(" <b>Inquiry Details : </b>" + dtInquriyDetails.Rows[0]["FollowupDetails"].ToString() + ""); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append(" <b>Priority : </b>" + dtInquriyDetails.Rows[0]["Priority"].ToString() + ""); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append(" <b>Job Entry Date & Time : </b>" + Convert.ToDateTime(dtInquriyDetails.Rows[0]["JobEntryDate"].ToString()).ToString("mm/dd/yyyy") + " " + dtInquriyDetails.Rows[0]["JobEntryTime"].ToString() + ""); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append(" <b>Forwarded By : </b>" + lblInqForBy.Text.Trim() + ""); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append(" <b>Remarks : </b>" + lblInqRemarks.Text.Trim() + ""); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append(" <b>Forward Approved By : </b>" + Views.frmHome.EmpName + ""); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append(" <b>Forward Approved Date & Time : </b>" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + ""); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append("Regards,"); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append("" + Views.frmHome.EmpName + ""); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append("<FONT COLOR=darkred>Auto generated email from CRM system</FONT>"); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append("</body>"); strBuliderEmailBody.Append("</html>"); EmailServices Email = new EmailServices(); Email.SendEmailsCC(strFromEmail.Trim(), strToEmail.Trim(), strCCEmail.Trim(), strBuliderEmailSubject.ToString(), strBuliderEmailBody.ToString()); }
public ActionResult Register(RegisterModel model, string returnUrl) { try { _log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); if (_log.IsInfoEnabled) { _log.Info("calling register post method"); } if (_log.IsInfoEnabled) { _log.Info(ModelState.IsValid); } if (ModelState.IsValid) { // Attempt to register the user if (_log.IsInfoEnabled) { _log.Info("calling CreateUser method of MembershipService"); } MembershipCreateStatus createStatus = MembershipService.CreateUser(model.UserName, model.Password, model.Email, model.PlantId); if (createStatus == MembershipCreateStatus.Success) { if (_log.IsInfoEnabled) { _log.Info("User Created from CreateUser method of MembershipService."); } FormsService.SignIn(model.UserName, false /* createPersistentCookie */); UserServices oUserServices = new UserServices(); var item = oUserServices.UserIdByUserName(model.UserName); string message = item.IsAnonymous ? "use the password you registered with" : "use your windows logon password"; EmailServices oEmailServices = new EmailServices(); oEmailServices.RegisteredUserEmail(model.Email, model.UserName, item.UserId, message); AdminServices oAdminServices = new AdminServices(); oAdminServices.InsertDefaultUserNotification(item.UserId); if (Url.IsLocalUrl(returnUrl) && returnUrl.Length > 1 && returnUrl.StartsWith("/") && !returnUrl.StartsWith("//") && !returnUrl.StartsWith("/\\")) { return(Redirect(returnUrl)); } else { return(RedirectToAction("Index", "Home")); } } else { if (_log.IsInfoEnabled) { _log.Info("Failed to register User from CreateUser method of MembershipService."); } ModelState.AddModelError("", AccountValidation.ErrorCodeToString(createStatus)); } } } catch (Exception ex) { if (_log.IsErrorEnabled) { _log.Error(ex.Message, ex); } throw ex; } // If we got this far, something failed, redisplay form ViewBag.PasswordLength = MembershipService.MinPasswordLength; model.Plants = _userServices.GetPlant(); return(View(model)); }
private void SendMailtoApproved() { string strFromEmail = ""; string strToEmail = ""; string strCCEmail = ""; List <string> strToEmails = new List <string>(); List <string> strCCEmails = new List <string>(); DataTable dtInquriyDetails = new DatabaseService().executeSelectQuery("SELECT * FROM Inquiry WHERE InquiryNumber = '" + lblChangeInqNo.Text.ToString() + "'"); DataTable dtCusDetais = new DatabaseService().executeSelectQuery("SELECT * FROM Customer WHERE Id = '" + GetCusId(lblChangeCus.Text.Trim()) + "'"); string[] acDate = lblChangeActDate.Text.ToString().Trim().Split(' '); // string[] dueDate = grdVwPendingAppDateChange.GetFocusedDataRow()["ReqCompDate"].ToString().Split(' '); string[] ReqDate = lblChangeReqDate.Text.ToString().Trim().Split(' '); strFromEmail = GetEmail(GetEmpId(Views.frmHome.EmpName)); strToEmail = GetEmail(dtInquriyDetails.Rows[0]["SiteResponsible"].ToString()); //strCCEmail = GetEmail(GetEmpId(lblInqForBy.Text.Trim())); StringBuilder strBuliderEmailSubject = new StringBuilder(); strBuliderEmailSubject.Append("Inquiry Completion Date Change Approved – Customer :" + lblChangeCus.Text.Trim() + " " + " -Inquiry No :" + lblChangeInqNo.Text.Trim() + " "); StringBuilder strBuliderEmailBody = new StringBuilder(); strBuliderEmailBody.Append("<head>"); strBuliderEmailBody.Append("<title>"); strBuliderEmailBody.Append(Guid.NewGuid().ToString()); strBuliderEmailBody.Append("</title>"); strBuliderEmailBody.Append("</head>"); strBuliderEmailBody.Append("<body>"); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append("Dear " + lblChangeReqBy.Text.Trim() + ","); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append("Inquiry Completion Date Change <b><u><FONT COLOR=DodgerBlue>Approved</FONT></u></b>,"); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append(" <b>Inquiry No : </b>" + lblChangeInqNo.Text.Trim() + ""); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append(" <b>Type : </b>" + lblChangeType.Text.Trim() + ""); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append(" <b>Customer : </b>" + lblChangeCus.Text.Trim() + ""); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append(" <b>Location : </b>" + GetSubLocationName(dtInquriyDetails.Rows[0]["Location"].ToString()) + ""); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append(" <b>Caller Name : </b>" + dtInquriyDetails.Rows[0]["CallerName"].ToString() + ""); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append(" <b>Caller Phone : </b>" + dtInquriyDetails.Rows[0]["CallerPhone"].ToString() + ""); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append(" <b>Inquiry Details : </b>" + dtInquriyDetails.Rows[0]["FollowupDetails"].ToString() + ""); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append(" <b>Priority : </b>" + dtInquriyDetails.Rows[0]["Priority"].ToString() + ""); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append(" <b>Accepted Date & Time : </b>" + acDate[0] + " " + lblChangeActTime.Text.ToString() + ""); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append(" <b>New Completion Date & Time : </b>" + ReqDate[0] + " " + lblChangeReqTime.Text.ToString() + ""); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append("Regards,"); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append("" + Views.frmHome.EmpName + ""); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append("<FONT COLOR=darkred>Auto generated email from CRM system</FONT>"); strBuliderEmailBody.Append("<br>"); strBuliderEmailBody.Append("</body>"); strBuliderEmailBody.Append("</html>"); EmailServices Email = new EmailServices(); Email.SendEmails(strFromEmail.Trim(), strToEmail.Trim(), strBuliderEmailSubject.ToString(), strBuliderEmailBody.ToString()); }
public ServiceResponse UserRegistration(UserModel model) { ServiceResponse response = new ServiceResponse(); model.IsRegistering = true; // Lookup account by business name, state, postal code BusinessModel identifiedBusiness = SearchForBusiness(model); // In order to prevent duplicates we will lookup the business by name, state, postal code // and if it exists return back the business and send an email to the super user that a user // wants to register if (identifiedBusiness != null) { model.Business = identifiedBusiness; model.ExistingBusiness = ExistingBusinessEnum.Existing; } response = userService.PostModel(this.CurrentUser, model); model = response.Model as UserModel; if (response.IsOK) { if (model.IsRegistering) { businessService.SetupDefaultPermission(this.CurrentUser, model.Business); userService.SetupDefaultPermissions(this.CurrentUser, model); try { var emailModel = userService.GetUserRegistrationEmailModel(model).Model as SendEmailModel; emailModel.Subject = "New Project Office Registration"; emailModel.RenderTextVersion = true; //emailModel.BodyTextVersion = RenderView(this, "SendEmailUserRegistration", emailModel); //emailModel.BodyTextVersion = MvcAccountController.RenderView(MvcAccountController, "SendEmailUserRegistration", emailModel); //GET var serializedModel = JsonConvert.SerializeObject(emailModel); var client = new HttpClient(); var baseUrl = Request.RequestUri.GetLeftPart(UriPartial.Authority); var result = client.GetAsync(baseUrl + "/ViewRender/Render?ViewName=UserRegistrationEmailTemplate&SerializedModel=" + serializedModel).Result; //var result = client.GetAsync(baseUrl + "/Account/Render?ViewName=SendEmailUserRegistration&SerializedModel=" + serializedModel).Result; //POST //ViewRenderModel viewRenderModel = new ViewRenderModel //{ // ViewName = "SendEmailUserRegistration", // ViewModel = emailModel //}; //var result = client.PostAsJsonAsync(baseUrl + "/ViewRender/Render", viewRenderModel).Result; emailModel.RenderTextVersion = false; //emailModel.BodyHtmlVersion = RenderView(this, "SendEmailUserRegistration", emailModel); var emailservice = new EmailServices(); emailservice.SendEmail(emailModel); } catch (Exception e) { Utilities.ErrorLog(e); } } //return PartialView("RegistrationAcknowledgement", "Account"); } //var userModel = response.Model as UserModel; //return PartialView("UserRegistration", this.ServiceResponse.Model); return(response); }
public BuySellsController() { _emailServices = new EmailServices(); }
// // GET: /Account/ public AccountController() { _usrService = new UserService(db); _ldryService = new LaunderyService(db); _emailService = new EmailServices(db); }
public BuySellsController(ApplicationUserManager userManager) { UserManager = userManager; _emailServices = new EmailServices(); }
public void Start() { ////////////////////////////////////// // // start error reporting lib ( decides if local and/or remote reporting) m_AppData.Logger = new ErrorLog(m_AppData); m_Log = (ErrorLog)m_AppData.Logger; ////////////////////////////////////// // // start email lib (used by error reporting lib for remote error notifications and by the watch list processor) m_AppData.EmailServices = new EmailServices(m_AppData); m_Email = (EmailServices)m_AppData.EmailServices; ////////////////////////////////////// // // load the Frame Generator m_AppData.FrameGenerator = (object)new FrameGenerator(m_AppData); ////////////////////////////////////// // // load the DVR m_DVR = new DVR(m_AppData); m_AppData.DVR = (object)m_DVR; ////////////////////////////////////// // // start the TCP Server m_RCServer = new RemoteConnectionServer.RemoteConnectionServer(m_AppData); //m_TCPServerThread = new Thread(TCPServer); //m_TCPServerThread.Start(); ////////////////////////////////////// // // load the LPR Engine m_LPREngine = new LPREngine(m_AppData); m_AppData.LPREngine = m_LPREngine; ////////////////////////////////////// // // load the Watch List Processor m_WatchList = new WatchLists(m_AppData); // now that all modules are loaded, let them register with each other for event communications m_RCServer.StartRegistration(); m_DVR.StartRegistration(); m_LPREngine.StartRegistration(); m_WatchList.StartRegistration(); // now let all modules start their threads m_RCServer.StartThreads(); m_DVR.StartThreads(); m_LPREngine.StartThreads(); m_WatchList.StartThreads(); m_Email.StartThreads(); // is everyone happy? if (!m_DVR.GetDVRReady || !((FrameGenerator)m_AppData.FrameGenerator).GetReadyStatus) { m_AppData.SelfDestruct(); } }
public ActionResult Edit(EditCart editCart, string notices) { try { var old = Carts.GetByID(editCart.ID); Cart cart = new Cart { ID = editCart.ID, CartStatus = editCart.CartStatus, SendStatus = editCart.SendStatus, SendDate = editCart.SendDate, DeliveryDate = editCart.DeliveryDate, ConfirmationStatus = editCart.ConfirmationStatus, ConfirmationDate = editCart.ConfirmationDate, BillNumber = editCart.BillNumber, Description = editCart.Description, LastUpdate = DateTime.Now, }; SaveNotes(editCart, editCart.ID, UserID); ViewBag.Success = true; Carts.UpdateByAdmin(cart); #region User Info var user = OSUsers.GetByID(old.UserID); #endregion User Info if (notices == "on") { #region Send Messages // تاییدیه مالی if (old.ConfirmationStatus != ConfirmationStatus.Approved && editCart.ConfirmationStatus == ConfirmationStatus.Approved) { SMSServices.FinancialConfirmation(user.Firstname, user.Lastname, user.Mobile, user.Id); EmailServices.FinancialConfirmation(user.Firstname, user.Lastname, user.Email, user.Id); } // بررسی شده if (old.SendStatus == SendStatus.NotChecked && cart.SendStatus == SendStatus.Checked) { SMSServices.CheckeProduct(user.Firstname, user.Lastname, user.Mobile, user.Id); EmailServices.CheckeProduct(user.Firstname, user.Lastname, user.Email, user.Id); } // ارسال کالا if (old.SendStatus == SendStatus.Checked && cart.SendStatus == SendStatus.Sent) { SMSServices.SendProduct(user.Firstname, user.Lastname, user.Mobile, user.Id, editCart.BillNumber); EmailServices.SendProduct(user.Firstname, user.Lastname, user.Email, user.Id, editCart.BillNumber); } // تحویل کالا if (old.SendStatus != SendStatus.Delivered && cart.SendStatus == SendStatus.Delivered) { SMSServices.DliverProduct(user.Firstname, user.Lastname, user.Mobile, user.Id); EmailServices.DliverProduct(user.Firstname, user.Lastname, user.Email, user.Id); } #endregion Send Messages } } catch (Exception ex) { SetErrors(ex); } return(RedirectToAction("Index")); }
public EmailTemplatesController(ICoreOrderService orderService, IPropertyService propertyService, IAccountServices accountServices, ILookupServices lookupServices, IEmailNotificationService emailNotificationService, EmailServices emailServices) : base(orderService, propertyService, accountServices, lookupServices) { _emailNotificationService = emailNotificationService; _emailServices = emailServices; }
public void SendEmail(Email _ObjEmail, string AttachmentPath) { string Username, Password, FromEmailAdress, OutHost, outEmailProtocol; int OutPort = 0; EmailServices emailService = new EmailServices(); var _listFromEmail = emailService.GetCredentials().FirstOrDefault(x => x.SmtpFromAddress == _ObjEmail.MailFrom); if (_listFromEmail != null) { Username = _listFromEmail.SmtpUser; Password = _listFromEmail.SmtpPassword; FromEmailAdress = _listFromEmail.SmtpFromAddress; outEmailProtocol = _listFromEmail.OutEmailProtocol; OutHost = _listFromEmail.OutHost; OutPort = _listFromEmail.OutPort; if (outEmailProtocol == "Exchange") // Added By Bidhan EmailProtocol == "POP3", will removed on production. { //Email _ObjEmail = new Email(); //DispositionAction dispositionAction = new DispositionAction(); const decimal kilobyte = 1024; ExchangeService service1 = new ExchangeService(ExchangeVersion.Exchange2010_SP1) { Credentials = new WebCredentials(Username, Password) }; //to add logic for itemview service1.AutodiscoverUrl(FromEmailAdress, RedirectionUrlValidationCallback); EmailMessage emailmessage = new EmailMessage(service1); emailmessage.Body = _ObjEmail.MailBody; if (_ObjEmail.MailTo != null && _ObjEmail.MailTo != "") { foreach (string emailTo in _ObjEmail.MailTo.Split(';')) { emailmessage.ToRecipients.Add(emailTo); } } if (_ObjEmail.MailSubject != null && _ObjEmail.MailSubject != "") { emailmessage.Subject = Convert.ToString(_ObjEmail.MailSubject); } if (_ObjEmail.MailCC != null && _ObjEmail.MailCC != "") { foreach (string emailCC in _ObjEmail.MailCC.Split(';')) { emailmessage.CcRecipients.Add(emailCC); } } if (AttachmentPath.Length > 0) { emailmessage.Attachments.AddFileAttachment(AttachmentPath); } emailmessage.Send(); } else if (outEmailProtocol.ToUpper() == "SMTP") { const decimal kilobyte = 1024; MailMessage message = new MailMessage(); if (_ObjEmail.MailTo != null && _ObjEmail.MailTo != "") { foreach (string emailTo in _ObjEmail.MailTo.Split(';')) { message.To.Add(emailTo); } } if (_ObjEmail.MailSubject != null && _ObjEmail.MailSubject != "") { message.Subject = Convert.ToString(_ObjEmail.MailSubject); } if (_ObjEmail.MailCC != null && _ObjEmail.MailCC != "") { foreach (string emailCC in _ObjEmail.MailCC.Split(';')) { message.CC.Add(emailCC); } } string strMailBody = _ObjEmail.MailBody; var view = AlternateView.CreateAlternateViewFromString(strMailBody, null, "text/html"); message.AlternateViews.Add(view); message.From = new MailAddress(FromEmailAdress); message.IsBodyHtml = true; System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient(OutHost); System.Net.NetworkCredential smtpAuthen = new System.Net.NetworkCredential(Username, Password); smtp.UseDefaultCredentials = false; smtp.Credentials = smtpAuthen; if (AttachmentPath.Length > 0) { message.Attachments.Add(new System.Net.Mail.Attachment(AttachmentPath)); } smtp.Send(message); } } }