protected void btnReview_Click(object sender, EventArgs e) { if (btnReview.Text == "Send Email") { int reqID = SaveToEmailJob(Session["EmailID"].ToString(), "Review"); if (reqID > 0) { EmailApp objEmailing = new EmailApp(); objEmailing.SendEmail(reqID, Convert.ToInt32(hWebinarID.Value)); lblError.ForeColor = System.Drawing.Color.Black; lblError.Text = "Successfully emailed"; } else { lblError.ForeColor = System.Drawing.Color.Red; lblError.Text = "Error encountered in emailing"; } } else { if (txtReviewerEmail.Text != "") { bool isEmailsvalid = true; System.Collections.ArrayList arrList = objUtil.StringToArrayList(txtReviewerEmail.Text, new char[] { ';' }); for (int idx = 0; idx < arrList.Count; idx++) { if (!objUtil.isEmail(arrList[idx].ToString())) { isEmailsvalid = false; break; } } if (isEmailsvalid) { int reqID = SaveToEmailJob(txtReviewerEmail.Text, "Review"); if (reqID > 0) { EmailApp objEmailing = new EmailApp(); objEmailing.SendEmail(reqID, Convert.ToInt32(hWebinarID.Value)); lblReviewError.ForeColor = System.Drawing.Color.Black; lblReviewError.Text = "Successfully emailed for review"; txtReviewerEmail.Text = ""; } else { lblReviewError.ForeColor = System.Drawing.Color.Red; lblReviewError.Text = "Error encountered in emailing"; } } else lblReviewError.Text = "Entered email(s) has invalid email address"; } else lblReviewError.Text = "No email address entered"; } }
protected void btnChangePassword_Click(object sender, EventArgs e) { InvalidPlaceholder.Visible = true; if (txtCurrentPassword.Text.Trim() == "" || txtNewPassword.Text.Trim() == "" || txtConfirmPassword.Text.Trim() == "") { lblError1.Text = "No password input can be empty"; } else { if (txtNewPassword.Text.Trim() != txtConfirmPassword.Text.Trim()) { lblError1.Text = "Mismatch of new password and confirm password"; } else { Regex objRegEx = new Regex("^.*(?=.{8,})(?=.*\\d)(?=.*[a-z])(?=.*[A-Z]).*$"); if (!objRegEx.IsMatch(txtNewPassword.Text)) { lblError1.Text = objErr.getMessage("AM0011"); } else { string rtnVal = objUserDA.ChangeUserPassword(txtEmailID.Text.Trim(),EBirdUtility.Encrypt(txtCurrentPassword.Text.Trim()), EBirdUtility.Encrypt(txtNewPassword.Text.Trim())); if (rtnVal != "") lblError1.Text = objErr.getMessage(rtnVal); else { int reqID = SaveToEmailJob(txtEmailID.Text.Trim()); if (reqID > 0) { EmailApp objEmailing = new EmailApp(); objEmailing.SendEmail(reqID); } txtPassword.Text = txtNewPassword.Text.Trim(); btnLogin_Click(null, null); } } } } }
protected void btnChangePassword_Click(object sender, EventArgs e) { if (txtCurrPassword.Text.Trim() == "" || txtNewPassword.Text.Trim() == "" || txtConfirmPassword.Text.Trim() == "") { lblError1.Text = "No password input can be empty"; } else { if (txtNewPassword.Text.Trim() != txtConfirmPassword.Text.Trim()) { lblError1.Text = "Mismatch of new password and confirm password"; } else { Regex objRegEx = new Regex("^.*(?=.{8,})(?=.*\\d)(?=.*[a-z])(?=.*[A-Z]).*$"); if (!objRegEx.IsMatch(txtNewPassword.Text)) { lblError1.Text = objErr.getMessage("AM0011"); } else { UserDA objUserDA = new UserDA(); string rtnVal = objUserDA.ChangeUserPassword(Session["EmailID"].ToString(), EBirdUtility.Encrypt(txtCurrPassword.Text.Trim()), EBirdUtility.Encrypt(txtNewPassword.Text.Trim())); if (rtnVal != "") lblError1.Text = objErr.getMessage(rtnVal); else { int reqID = SaveToEmailJob(Session["EmailID"].ToString()); if (reqID > 0) { EmailApp objEmailing = new EmailApp(); objEmailing.SendEmail(reqID); } lblError1.Text = "Password changed successfully, login using your changed password"; } } } } }
private int SaveToEmailJob(string emailID) { EmailBE objEmailBE = new EmailBE(); EmailDA objEmailDA = new EmailDA(); EmailApp objEmailing = new EmailApp(); string emlContent = objEmailing.getHTMLFormattedPasswdChangeNotify(emailID); objEmailBE.isToEmailRef = false; objEmailBE.RequestStatus = "No-delay"; objEmailBE.RequestType = "Password Changed"; objEmailBE.Subject = "Password Changed Notification"; objEmailBE.SubmittedBy = 0; objEmailBE.ToEmail = emailID; objEmailBE.FromEmail = "*****@*****.**"; objEmailBE.EmailContent = emlContent; return objEmailDA.SaveEmailRequest(objEmailBE); }
private void saveUserRec() { UserBE objUsr = new UserBE(); objUsr.EmailID = txtUserEmail.Text; objUsr.FirstName = txtUserFName.Text; objUsr.LastName = txtUserLName.Text; objUsr.Address = ""; objUsr.Telephone = txtUserPhone.Text.Trim(); objUsr.Role = (chkAdmin.Checked ? "Admin" : "User"); objUsr.ClientID = Convert.ToInt32(Session["ClientID"]); objUsr.Department = txtUserDept.Text; objUsr.UserStatus = hUserStatus.Value; objUsr.isPrimary = false; objUsr.CreatedBy = Convert.ToInt32(Session["UserID"]); objUsr.UserID = Convert.ToInt32(hUserID.Value); if (objUsr.ClientID == 0) { objUsr.Role = "AEAdmin"; } if (hAction.Value == "A") { string rndPasswd = RandomPassword.Generate(); objUsr.Password = EBirdUtility.Encrypt(rndPasswd); if (objUserDA.AddUserAccountDA(objUsr) > 0) { popUsers(); // Emailing the account details to user int reqID = SaveToEmailJob(txtUserEmail.Text, rndPasswd); if (reqID > 0) { EmailApp objEmailing = new EmailApp(); objEmailing.SendEmail(reqID); } lbtnBack_Click(null, null); } else { dvMsg.Visible = true; lblmsg.Text = objError.getMessage("AM0002"); } } if (hAction.Value == "E") { int PrimaryAdmin = objUsr.UserID; if (lblPrimary.Visible) { if (chkAdmin.Checked) objUsr.isPrimary = true; else PrimaryAdmin = Convert.ToInt32(rcmbAdmin.SelectedValue); } if (objUserDA.UpdateUserRecord(objUsr, PrimaryAdmin)) { popUsers(); lbtnBack_Click(null, null); } else { dvMsg.Visible = true; lblmsg.Text = objError.getMessage("AM0012"); } } }
private int SaveToEmailJob(string emailID, string genPasswd) { EmailBE objEmailBE = new EmailBE(); EmailDA objEmailDA = new EmailDA(); EmailApp objEmailing = new EmailApp(); string emlContent = objEmailing.getHTMLFormattedNewAccountNotify(emailID, genPasswd, DateTime.Now.ToString()); objEmailBE.isToEmailRef = false; objEmailBE.RequestStatus = "No-delay"; objEmailBE.RequestType = "New User Account"; objEmailBE.Subject = "Welcome to SnapSession!"; objEmailBE.SubmittedBy = Convert.ToInt32(Session["UserID"]); objEmailBE.ToEmail = emailID; objEmailBE.FromEmail = "*****@*****.**"; objEmailBE.EmailContent = emlContent; return objEmailDA.SaveEmailRequest(objEmailBE); }
protected void btnSave_Click(object sender, EventArgs e) { int ID = Convert.ToInt32(hClientID.Value); if (ID != 0 && (hCurrStatus.Value != rcmbStatus.SelectedValue)) { objClientDA.UpdateClientStatusDA(ID, rcmbStatus.SelectedValue, Convert.ToInt32(Session["UserID"])); popClients(); lbtnBack_Click(null, null); } else { // Business rule check if ((ID != 0) && (Convert.ToInt32(txtNoUsers.Text) < Convert.ToInt32(hActiveUserCnt.Value))) { dvValidationMsg.Visible = true; lblValidationMsg.Text = objError.getMessage("SS0003"); } else if (ID != 0) { if (objUserDA.isUserExistDA(txtAdminEmail.Text.Trim(), Convert.ToInt32(hAdminID.Value))) { dvValidationMsg.Visible = true; lblValidationMsg.Text = objError.getMessage("AM0012"); } } else if (ID == 0) { if (objUserDA.isUserExistDA(txtAdminEmail.Text.Trim())) { dvValidationMsg.Visible = true; lblValidationMsg.Text = objError.getMessage("AM0002"); } } if (dvValidationMsg.Visible == false) { #region add/update client profile objClientBE.ClientID = ID; objClientBE.ClientName = txtClientName.Text; objClientBE.Address1 = txtAddress.Text; objClientBE.City = txtCity.Text; objClientBE.State = txtState.Text; objClientBE.CountryID = Convert.ToInt32(rcmbCountry.SelectedValue); objClientBE.PostCode = txtPostcode.Text; objClientBE.Phone = txtPhone.Text; objClientBE.Website = txtWebsite.Text; objClientBE.IndustryID = Convert.ToInt32(rcmbIndustry.SelectedValue); objClientBE.AnnualRevID = Convert.ToInt32(rcmbRevenue.SelectedValue); objClientBE.NoOfUsers = Convert.ToInt32(txtNoUsers.Text); objClientBE.CurrentPkgSubscribed = chkPackage.SelectedValue; objClientBE.ClientStatus = rcmbStatus.SelectedValue; // "Active"; objClientBE.CreatedBy = Convert.ToInt32(Session["UserID"]); ID = objClientDA.SaveClientProfileDA(objClientBE); #endregion #region Creating required folder structure for client if (hClientID.Value == "0" && ID != 0) { DocAccess objDocAccess = new DocAccess(); if (!objDocAccess.InitClientFolders(ID)) lblFilterError.Text = objError.getMessage("AM0010"); } #endregion #region Updating primary contact and administrator if (ID != 0) { lblClientError.Text = ""; //Saving Contact ContactBE objContact = new ContactBE(); objContact.ClientID = ID; objContact.ContactID = Convert.ToInt32(hContactID.Value); objContact.Contactname = txtContactName.Text; objContact.Phone = txtContactPhone.Text; objContact.Email = txtContactEmail.Text; objContact.Department = txtContactDepart.Text; objContact.JobTitle = txtJobTitle.Text; objClientDA.SaveClientContactDA(objContact); //Saving Primary administrator UserBE objUserBE = new UserBE(); objUserBE.UserID = Convert.ToInt32(hAdminID.Value); objUserBE.EmailID = txtAdminEmail.Text; objUserBE.FirstName = txtAdminFName.Text; objUserBE.LastName = txtAdminLName.Text; objUserBE.Address = ""; objUserBE.Telephone = txtAdminPhone.Text; objUserBE.Role = "Admin"; objUserBE.ClientID = ID; objUserBE.Department = txtAdminDept.Text; objUserBE.UserStatus = "Active"; objUserBE.isPrimary = true; objUserBE.CreatedBy = Convert.ToInt32(Session["UserID"]); if (Convert.ToInt32(hAdminID.Value) != 0) { if (!objUserDA.UpdateUserRecord(objUserBE, objUserBE.UserID)) lblClientError.Text = objError.getMessage("AM0012"); } else { string rndPasswd = RandomPassword.Generate(); objUserBE.Password = rndPasswd; if (objUserDA.AddUserAccountDA(objUserBE) > 0) { // Emailing the account details to user int reqID = SaveToEmailJob(txtAdminEmail.Text, rndPasswd); if (reqID > 0) { EmailApp objEmailing = new EmailApp(); objEmailing.SendEmail(reqID); } } } // Following commented on 2/20/13 - J, as these logics ar moved inside the sp for add/edit client profile //if (hClientID.Value == "0") // objClientDA.InitClientConfigDA(ID, chkPackage.SelectedValue, false); //else if (hCurrPkg.Value != chkPackage.SelectedValue) // objClientDA.InitClientConfigDA(ID, chkPackage.SelectedValue, true); //Session["clientID"] = ID.ToString(); //Response.Redirect("ClientConfig/"); popClients(); if (lblClientError.Text == "") lbtnBack_Click(null, null); } #endregion if (lblClientError.Text == "") clearAll(); } } }
protected void lbtnEmailInvite1_Click(object sender, EventArgs e) { try { int reqID = SaveToEmailJob(Session["EmailID"].ToString(), "Webinar Invitation"); string sMsg = "Successfully emailed..."; if (reqID > 0) { EmailApp objEmailing = new EmailApp(); objEmailing.SendEmail(reqID, Convert.ToInt32(hWebinarID.Value)); } else sMsg = "Error encountered in emailing"; lblMsg.Text = sMsg; } catch (Exception ex) { lblMsg.ForeColor = System.Drawing.Color.Red; lblMsg.Text = "ERROR: " + ex.Message; } }
public void ConnectRegistrationEmailing() { if (chkAPI.Checked && !ConnectRegistration) { int reqID = SaveToEmailJob(txtAPIReg.Text.Trim(), "Connect Your Registration"); if (reqID > 0) { EmailApp objEmailing = new EmailApp(); objEmailing.SendEmail(reqID, Constant.DocRepRoot + Constant.ConnectRegInstructionDoc); objWebinarDA.UpdateWebinarRegistrationEmailUpdate(Convert.ToInt32(hWebinarID.Value), "ConnectReg"); } } }
public void CampaignTrackingEmailing() { if (chkCamp.Checked && !CampTrackerEmail) { int reqID = SaveToEmailJob(txtEmailCampaign.Text.Trim(), "Campaign Tracking"); if (reqID > 0) { EmailApp objEmailing = new EmailApp(); objEmailing.SendEmail(reqID, Constant.DocRepRoot + Constant.CampTrackInstructionDoc); objWebinarDA.UpdateWebinarRegistrationEmailUpdate(Convert.ToInt32(hWebinarID.Value), "CampTracking"); } } }
private int SaveToEmailJob(string toEmail, string reqTyp) { EmailBE objEmailBE = new EmailBE(); EmailDA objEmailDA = new EmailDA(); EmailApp objEmailing = new EmailApp(); string emlContent = string.Empty; string frEmail = string.Empty; string subject = string.Empty; switch (reqTyp) { case "Webinar Invitation": int webinarID = Convert.ToInt32(hWebinarID.Value); List<WebinarEmailBE> objWBEmail = new List<WebinarEmailBE>(); objWBEmail = objEmailDA.GetWebinarEmail(webinarID, reqTyp); emlContent = objEmailing.getHTMLFormattedEmailContent(objWBEmail[0].EmailContent, objWBEmail[0].RequestType, webinarID); emlContent = objEmailing.getFormedEmailContent(emlContent, reqTyp, webinarID); frEmail = Session["EmailID"].ToString(); subject = "Webinar Invitation"; break; case "Campaign Tracking": emlContent = objEmailing.getHTMLFormattedGeneralEmail(reqTyp, Convert.ToInt32(Session["Client_LanguageID"])); frEmail = "*****@*****.**"; subject = "SnapSession Webinar Campaign Tracking"; break; case "Connect Your Registration": emlContent = objEmailing.getHTMLFormattedGeneralEmail(reqTyp, Convert.ToInt32(Session["Client_LanguageID"])); frEmail = "*****@*****.**"; subject = "SnapSession Connect Your Registration"; break; } objEmailBE.isToEmailRef = false; objEmailBE.RequestStatus = "No-delay"; objEmailBE.RequestType = reqTyp; objEmailBE.Subject = subject; objEmailBE.SubmittedBy = Convert.ToInt32(Session["UserID"]); objEmailBE.ToEmail = toEmail; objEmailBE.FromEmail = frEmail; objEmailBE.EmailContent = emlContent; return objEmailDA.SaveEmailRequest(objEmailBE); }