protected void btnDeclineSwitch_Click(object sender, EventArgs e) { String strSchemeID = Session[clsSystem_Session.strSession.tempschemeid.ToString()].ToString(); String strUserID = Session[clsSystem_Session.strSession.User.ToString()].ToString(); String strClientID = Session[clsSystem_Session.strSession.clientID.ToString()].ToString(); clsScheme Scheme = new clsScheme(strClientID, strSchemeID); int intSwitchID = propSwitchID; try { clsIFA IFA = new clsIFA(int.Parse(Session["ifaid"].ToString())); clsClient Client = new clsClient(strClientID); String strEmailMessage = ""; String strRecipient = IFA.propIFAEmail; try { strEmailMessage = clsEmail.generateEmailBody("ClientDeclineNotification", IFA.propIFA_Name, Client.propForename + " " + Client.propSurname, Scheme.propCompany.propCompany, null, this.txtDeclineDescription.Text.Trim(), null, null); } catch { Page.ClientScript.RegisterStartupScript(this.GetType(), "AlertNoEmailTemplate", "alert('System error! No email template found for declining email. Please report this error to your systems administrator');", true); return; } clsEmail.Send(strRecipient, "*****@*****.**", "NAV-Switch client declined proposed switch", strEmailMessage, intSwitchID, strClientID, clsEmail.enumEmailPurpose.ClientDeclinedSwitchScheme); clsSwitchScheme.updateSwitchHeader(intSwitchID, clsSwitch.enumSwitchStatus.Declined_Client, new clsSwitch(intSwitchID).propDescription); int intHistoryID = clsHistory.clsHistoryScheme.insertHeader(strSchemeID, intSwitchID, (Int16)clsSwitch.enumSwitchStatus.Declined_Client); clsHistory.clsHistoryScheme.insertMessage(intHistoryID, strEmailMessage); clsSwitchScheme_Client.declineSwitch(intSwitchID); Page.ClientScript.RegisterStartupScript(this.GetType(), "alertDeclinedSwitch", "alert('This switch has been declined.'); window.location='" + this.propBackPageURL + "';", true); } catch (Exception ex) { Page.ClientScript.RegisterStartupScript(this.GetType(), "alertDeclinedSwitcherror", "alert('Error declining switch! " + ex.ToString().Replace("'", " ") + "'); window.location='" + this.propBackPageURL + "';", true); } }
protected void NotifyApprovedSwtich(clsSwitch Switch) { try { int intIFAID = int.Parse(Session["ifaid"].ToString()); clsIFA IFA = new clsIFA(intIFAID); string htmlTemplate = clsOutput.generateApprovedSwitch(Switch, IFA.propIFA_ID); StyleSheet style = clsOutput.getStyleSheet_ApprovedSwitch(); string strFilename = clsOutput.generateOutputFile(clsOutput.enumOutputType.PDF, htmlTemplate, style, Switch.propSwitchID, clsOutput.enumSwitchType.Portfolio); string strRecepient = IFA.propIFAEmail; string strSender = "*****@*****.**"; string strSubject = "Switch Instruction"; string strBody = clsEmail.generateEmailBody((Switch.propPortfolio.propConfirmationRequired ? "NotifyApprovedEmailReqSign" : "NotifyApprovedEmail"), null, null, null, null, null, Switch.propPortfolio.propCompany, Switch.propSwitchID.ToString()); clsEmail.SendWithAttachment(strRecepient, strSender, strSubject, strBody, Switch.propSwitchID, Switch.propClientID, clsEmail.enumEmailPurpose.ApproveSwitchNotification, strFilename); clsClient client = new clsClient(Switch.propClientID); string ClientName = client.propForename + " " + client.propSurname; if (!String.IsNullOrEmpty(client.propEmailWork)) { strRecepient = client.propEmailWork; strBody = clsEmail.generateEmailBody((Switch.propPortfolio.propConfirmationRequired ? "NotifyClientApprovedEmailReqSign" : "NotifyClientApprovedEmail"), null, null, ClientName, null, null, Switch.propPortfolio.propCompany, null); clsEmail.SendWithAttachment(strRecepient, strSender, strSubject, strBody, Switch.propSwitchID, Switch.propClientID, clsEmail.enumEmailPurpose.ApproveSwitchNotification, strFilename); } if (!String.IsNullOrEmpty(client.propEmailPersonal)) { strRecepient = client.propEmailPersonal; strBody = clsEmail.generateEmailBody((Switch.propPortfolio.propConfirmationRequired ? "NotifyClientApprovedEmailReqSign" : "NotifyClientApprovedEmail"), null, null, ClientName, null, null, Switch.propPortfolio.propCompany, null); clsEmail.SendWithAttachment(strRecepient, strSender, strSubject, strBody, Switch.propSwitchID, Switch.propClientID, clsEmail.enumEmailPurpose.ApproveSwitchNotification, strFilename); } //:SwitchType_IFA Name_Client Name_yyyy-mm-dd.pdf } catch (Exception ex) { Response.Write("Exception Occured<br/>"); Response.Write(String.Format("<p>{0}</p><br/>", ex.ToString())); } }
protected void NotifyApprovedSwtich(clsPortfolio Portfolio) { //try //{ int intIFAID = int.Parse(Session["ifaid"].ToString()); clsIFA IFA = new clsIFA(intIFAID); string htmlTemplate = clsOutput.generateApprovedSwitch(Portfolio, IFA.propIFA_ID); StyleSheet style = clsOutput.getStyleSheet_ApprovedSwitch(); string strFilename = clsOutput.generateOutputFile(clsOutput.enumOutputType.PDF, htmlTemplate, style, Portfolio.propSwitch.propSwitchID, clsOutput.enumSwitchType.Portfolio); string strRecepient = IFA.propIFAEmail; string strSender = "*****@*****.**"; string strSubject = "Switch Instruction"; string strBody = clsEmail.generateEmailBody(((new clsCompany(Portfolio.propCompanyID)).propSignedConfirmation ? "NotifyApprovedEmailReqSign" : "NotifyApprovedEmail"), null, null, null, null, null, Portfolio.propCompany, Portfolio.propSwitch.propSwitchID.ToString()); clsEmail.SendWithAttachment(strRecepient, strSender, strSubject, strBody, Portfolio.propSwitch.propSwitchID, Portfolio.propClientID, clsEmail.enumEmailPurpose.ApproveSwitchNotification, strFilename); clsClient client = new clsClient(Portfolio.propClientID); string ClientName = client.propForename + " " + client.propSurname; if (!String.IsNullOrEmpty(client.propEmailWork)) { strRecepient = client.propEmailWork; strBody = clsEmail.generateEmailBody(((new clsCompany(Portfolio.propCompanyID)).propSignedConfirmation ? "NotifyClientApprovedEmailReqSign" : "NotifyClientApprovedEmail"), null, null, ClientName, null, null, Portfolio.propCompany, null); clsEmail.SendWithAttachment(strRecepient, strSender, strSubject, strBody, Portfolio.propSwitch.propSwitchID, Portfolio.propClientID, clsEmail.enumEmailPurpose.ApproveSwitchNotification, strFilename); } if (!String.IsNullOrEmpty(client.propEmailPersonal)) { strRecepient = client.propEmailPersonal; strBody = clsEmail.generateEmailBody(((new clsCompany(Portfolio.propCompanyID)).propSignedConfirmation ? "NotifyClientApprovedEmailReqSign" : "NotifyClientApprovedEmail"), null, null, ClientName, null, null, Portfolio.propCompany, null); clsEmail.SendWithAttachment(strRecepient, strSender, strSubject, strBody, Portfolio.propSwitch.propSwitchID, Portfolio.propClientID, clsEmail.enumEmailPurpose.ApproveSwitchNotification, strFilename); } //:SwitchType_IFA Name_Client Name_yyyy-mm-dd.pdf //} //catch (Exception ex) //{ // Response.Write("Exception Occured<br/>"); // Response.Write(String.Format("<p>{0}</p><br/>", ex.ToString())); //} }
protected void btnDeclineSwitch_Click(object sender, EventArgs e) { strUserID = Session[clsSystem_Session.strSession.User.ToString()].ToString(); strClientID = Session[clsSystem_Session.strSession.clientID.ToString()].ToString(); strPortfolioID = Session[clsSystem_Session.strSession.tempportfolioid.ToString()].ToString(); clsPortfolio oPortfolio = new clsPortfolio(strClientID, strPortfolioID, strUserID); int intSwitchID = (int)ViewState["intSwitchID"]; string backPageURL = "https://" + Request.ServerVariables["SERVER_NAME"] + ":" + Request.ServerVariables["SERVER_PORT"] + "/report/" + "portfoliodetails.asp"; try { clsIFA IFA = new clsIFA(int.Parse(Session["ifaid"].ToString())); clsClient Client = new clsClient(strClientID); String strEmailMessage = ""; String strRecipient = IFA.propIFAEmail; try { strEmailMessage = clsEmail.generateEmailBody("ClientDeclineNotification", IFA.propIFA_Name, Client.propForename + " " + Client.propSurname, oPortfolio.propCompany, null, this.txtDeclineDescription.Text.Trim(), null, null); } catch { ClientScript.RegisterStartupScript(this.GetType(), "AlertNoEmailTemplate", "alert('System error! No email template found for declining email. Please report this error to your systems administrator');", true); return; } clsEmail.Send(strRecipient, "*****@*****.**", "NAV-Switch client declined proposed switch", strEmailMessage, intSwitchID, strClientID, clsEmail.enumEmailPurpose.ClientDeclinedSwitchPortfolio); clsSwitch.updateSwitchHeader(intSwitchID, clsSwitch.enumSwitchStatus.Declined_Client, new clsSwitch(intSwitchID).propDescription); int intHistoryID = clsHistory.insertHeader(oPortfolio.propPortfolioID, intSwitchID, (Int16)clsSwitch.enumSwitchStatus.Declined_Client); clsHistory.insertMessage(intHistoryID, strEmailMessage); clsSwitch_Client.declineSwitch(intSwitchID); ClientScript.RegisterStartupScript(this.GetType(), "alertDeclinedSwitch", "alert('This switch has been declined.'); window.location='" + backPageURL + "';", true); } catch (Exception ex) { ClientScript.RegisterStartupScript(this.GetType(), "alertDeclinedSwitcherror", "alert('Error declining switch! " + ex.ToString().Replace("'", " ") + "'); window.location='" + backPageURL + "';", true); } }
protected void btnContactMeSend_Click(object sender, EventArgs e) { strClientID = Session[clsSystem_Session.strSession.clientID.ToString()].ToString(); strPortfolioID = Session[clsSystem_Session.strSession.tempportfolioid.ToString()].ToString(); strUserID = Session[clsSystem_Session.strSession.User.ToString()].ToString(); clsIFA IFA = new clsIFA(int.Parse(Session["ifaid"].ToString())); clsClient Client = new clsClient(strClientID); clsPortfolio Portfolio = new clsPortfolio(strClientID, strPortfolioID, strUserID); String strEmailMessage = ""; try { String strRecipient = IFA.propIFAEmail; try { strEmailMessage = clsEmail.generateEmailBody("ClientRequestContact", IFA.propIFA_Name, Client.propForename + " " + Client.propSurname, Portfolio.propCompany, this.txtContactMeByTel.Text.Trim(), this.txtContactMeComments.Text.Trim(), null, null); } catch { ClientScript.RegisterStartupScript(this.GetType(), "AlertNoEmailTemplate", "alert('System error! No email template found for this purpose. Please report this error to your systems administrator');", true); return; } clsEmail.Send(strRecipient, "*****@*****.**", "NAV-Switch client request", strEmailMessage, Portfolio.propSwitch.propSwitchID, strClientID, clsEmail.enumEmailPurpose.ClientRequestingContact); clsSwitch.updateSwitchHeader(Portfolio.propSwitch.propSwitchID, clsSwitch.enumSwitchStatus.Request_ForDiscussion); int intHistoryID = clsHistory.insertHeader(Portfolio.propPortfolioID, Portfolio.propSwitch.propSwitchID, (Int16)clsSwitch.enumSwitchStatus.Request_ForDiscussion); clsHistory.insertMessage(intHistoryID, strEmailMessage); ClientScript.RegisterStartupScript(this.GetType(), "EmailRequestContactSent", "alert('Request for contact to your IFA has been sent successfully');", true); populateProposedSwitch(Portfolio.propSwitch.propSwitchDetails); enableButtons(clsSwitch.enumSwitchStatus.Request_ForDiscussion); } catch (Exception ex) { ClientScript.RegisterStartupScript(this.GetType(), "EmailFailedAlert", "alert('Sending failed. Error: " + ex.Message.Replace("'", " ") + "');", true); return; } }
protected void btnAmendSave_Click(object sender, EventArgs e) { captureSwitchGridviewDetails(); strUserID = Session[clsSystem_Session.strSession.User.ToString()].ToString(); strClientID = Session[clsSystem_Session.strSession.clientID.ToString()].ToString(); strPortfolioID = Session[clsSystem_Session.strSession.tempportfolioid.ToString()].ToString(); List<clsSwitchDetails_Client> ListSwitchDetails = (List<clsSwitchDetails_Client>)Session["SwitchDetails_Client"]; saveclientSwitch(clsSwitch.enumSwitchStatus.Saved, ListSwitchDetails[0].propSwitchID, this.txtAmendDesc.Text.Trim()); clsPortfolio oPortfolio = new clsPortfolio(strClientID, strPortfolioID, strUserID); bool hasIFAPermit = oPortfolio.propPortfolioDetails[0].propSwitchIFAPermit; int intSwitchID = ListSwitchDetails[0].propSwitchID; if (hasIFAPermit) { sendValidationCode(this.txtSMSMobileNoApproval.Text.Trim()); } else { clsIFA IFA = new clsIFA(int.Parse(Session["ifaid"].ToString())); clsClient Client = new clsClient(strClientID); String strEmailMessage = ""; try { String strRecipient = IFA.propIFAEmail; try { strEmailMessage = clsEmail.generateEmailBody("ClientAmendmentNotification", null, Client.propForename + " " + Client.propSurname, null, null, null, null, null); } catch { ClientScript.RegisterStartupScript(this.GetType(), "AlertNoEmailTemplate", "alert('System error! No email template found for this purpose. Please report this error to your systems administrator');", true); return; } clsEmail.Send(strRecipient, "*****@*****.**", "NAV-Switch client amended proposed switch", strEmailMessage, oPortfolio.propSwitch.propSwitchID, strClientID, clsEmail.enumEmailPurpose.ClientRequestingContact); clsSwitch_Client.updateSwitchHeader(clsSwitch.enumSwitchStatus.Proposed, intSwitchID, this.txtAmendDesc.Text.Trim()); clsSwitch.updateSwitchHeader(intSwitchID, clsSwitch.enumSwitchStatus.Amended, new clsSwitch(intSwitchID).propDescription); int intHistoryID = clsHistory.insertHeader(oPortfolio.propPortfolioID, intSwitchID, (Int16)clsSwitch.enumSwitchStatus.Amended); clsHistory.insertDetailsClient(intHistoryID, ListSwitchDetails); clsHistory.insertMessage(intHistoryID, this.txtAmendDesc.Text.Trim()); string backPageURL = "https://" + Request.ServerVariables["SERVER_NAME"] + ":" + Request.ServerVariables["SERVER_PORT"] + "/report/" + "portfoliodetails.asp"; ClientScript.RegisterStartupScript(this.GetType(), "EmailAmendNotification", "alert('An email was sent to notify your IFA regarding the amendments in the proposed switch.'); window.location='" + backPageURL + "';", true); } catch (Exception ex) { ClientScript.RegisterStartupScript(this.GetType(), "EmailFailedAlert", "alert('Sending failed. Error: " + ex.Message.Replace("'", " ") + "');", true); return; } } Session["SwitchDetails_Client"] = oPortfolio.propSwitchClient.propSwitchDetails; populateAmendSwitch((List<clsSwitchDetails_Client>)Session["SwitchDetails_Client"]); }
protected void btnAmendSave_Click(object sender, EventArgs e) { captureSwitchGridviewDetails(); String strClientID = Session[clsSystem_Session.strSession.clientID.ToString()].ToString(); String strSchemeID = Session[clsSystem_Session.strSession.tempschemeid.ToString()].ToString(); String strUserID = Session[clsSystem_Session.strSession.User.ToString()].ToString(); saveclientSwitch(clsSwitch.enumSwitchStatus.Saved, propSwitchID, this.txtAmendDesc.Text.Trim()); bool hasIFAPermit = (bool)Session["IFAPermit"]; int intSwitchID = propSwitchID; if (hasIFAPermit) { sendValidationCode(this.txtSMSMobileNoApproval.Text.Trim()); } else { clsIFA IFA = new clsIFA(int.Parse(Session["ifaid"].ToString())); clsClient Client = new clsClient(strClientID); String strEmailMessage = ""; try { String strRecipient = IFA.propIFAEmail; try { strEmailMessage = clsEmail.generateEmailBody("SchemeClientAmendmentNotification", null, Client.propForename + " " + Client.propSurname, null, null, null, null, null); strEmailMessage = Server.HtmlEncode(strEmailMessage); } catch { Page.ClientScript.RegisterStartupScript(this.GetType(), "AlertNoEmailTemplate", "alert('System error! No email template found for this purpose. Please report this error to your systems administrator');", true); return; } clsSwitchScheme_Client.updateSwitchHeader(clsSwitch.enumSwitchStatus.Proposed, intSwitchID, this.txtAmendDesc.Text.Trim()); clsSwitchScheme.updateSwitchHeader(intSwitchID, clsSwitch.enumSwitchStatus.Amended, new clsSwitchScheme(intSwitchID).propDescription); clsEmail.Send(strRecipient, "*****@*****.**", "NAV-Switch client amended proposed scheme switch", strEmailMessage, propSwitchID, strClientID, clsEmail.enumEmailPurpose.ClientAmendmentsNotification); int intHistoryID = clsHistory.clsHistoryScheme.insertHeader(strSchemeID, intSwitchID, (Int16)clsSwitch.enumSwitchStatus.Amended); clsHistory.clsHistoryScheme.insertDetailsClient(intHistoryID, new clsSwitchScheme_Client(intSwitchID).propSwitchDetailsPortfolio, false); clsHistory.clsHistoryScheme.insertDetailsClient(intHistoryID, new clsSwitchScheme_Client(intSwitchID).propSwitchDetailsContribution, true); clsHistory.clsHistoryScheme.insertMessage(intHistoryID, this.txtAmendDesc.Text.Trim()); Page.ClientScript.RegisterStartupScript(this.GetType(), "EmailAmendNotification", "alert('An email was sent to notify your IFA regarding the amendments in the proposed scheme switch.'); window.location='" + propBackPageURL + "';", true); } catch (Exception ex) { Page.ClientScript.RegisterStartupScript(this.GetType(), "EmailFailedAlert", "alert('" + ex + "');", true); return; } } }
protected void btnAmendSave_Click(object sender, EventArgs e) { captureSwitchGridviewDetails(); strUserID = Session[clsSystem_Session.strSession.User.ToString()].ToString(); strClientID = Session[clsSystem_Session.strSession.clientID.ToString()].ToString(); strPortfolioID = Session[clsSystem_Session.strSession.tempportfolioid.ToString()].ToString(); List <clsSwitchDetails_Client> ListSwitchDetails = (List <clsSwitchDetails_Client>)Session["SwitchDetails_Client"]; saveclientSwitch(clsSwitch.enumSwitchStatus.Saved, ListSwitchDetails[0].propSwitchID, this.txtAmendDesc.Text.Trim()); clsPortfolio oPortfolio = new clsPortfolio(strClientID, strPortfolioID, strUserID); bool hasIFAPermit = oPortfolio.propPortfolioDetails[0].propSwitchIFAPermit; int intSwitchID = ListSwitchDetails[0].propSwitchID; if (hasIFAPermit) { sendValidationCode(this.txtSMSMobileNoApproval.Text.Trim()); } else { clsIFA IFA = new clsIFA(int.Parse(Session["ifaid"].ToString())); clsClient Client = new clsClient(strClientID); String strEmailMessage = ""; try { String strRecipient = IFA.propIFAEmail; try { strEmailMessage = clsEmail.generateEmailBody("ClientAmendmentNotification", null, Client.propForename + " " + Client.propSurname, null, null, null, null, null); } catch { ClientScript.RegisterStartupScript(this.GetType(), "AlertNoEmailTemplate", "alert('System error! No email template found for this purpose. Please report this error to your systems administrator');", true); return; } clsEmail.Send(strRecipient, "*****@*****.**", "NAV-Switch client amended proposed switch", strEmailMessage, oPortfolio.propSwitch.propSwitchID, strClientID, clsEmail.enumEmailPurpose.ClientRequestingContact); clsSwitch_Client.updateSwitchHeader(clsSwitch.enumSwitchStatus.Proposed, intSwitchID, this.txtAmendDesc.Text.Trim()); clsSwitch.updateSwitchHeader(intSwitchID, clsSwitch.enumSwitchStatus.Amended, new clsSwitch(intSwitchID).propDescription); int intHistoryID = clsHistory.insertHeader(oPortfolio.propPortfolioID, intSwitchID, (Int16)clsSwitch.enumSwitchStatus.Amended); clsHistory.insertDetailsClient(intHistoryID, ListSwitchDetails); clsHistory.insertMessage(intHistoryID, this.txtAmendDesc.Text.Trim()); string backPageURL = "https://" + Request.ServerVariables["SERVER_NAME"] + ":" + Request.ServerVariables["SERVER_PORT"] + "/report/" + "portfoliodetails.asp"; ClientScript.RegisterStartupScript(this.GetType(), "EmailAmendNotification", "alert('An email was sent to notify your IFA regarding the amendments in the proposed switch.'); window.location='" + backPageURL + "';", true); } catch (Exception ex) { ClientScript.RegisterStartupScript(this.GetType(), "EmailFailedAlert", "alert('Sending failed. Error: " + ex.Message.Replace("'", " ") + "');", true); return; } } Session["SwitchDetails_Client"] = oPortfolio.propSwitchClient.propSwitchDetails; populateAmendSwitch((List <clsSwitchDetails_Client>)Session["SwitchDetails_Client"]); }
protected void NotifyApprovedSwtich(clsSwitch Switch) { int intIFAID = int.Parse(Session["ifaid"].ToString()); clsIFA IFA = new clsIFA(intIFAID); string htmlTemplate = clsOutput.generateApprovedSwitch(Switch, IFA.propIFA_ID); StyleSheet style = clsOutput.getStyleSheet_ApprovedSwitch(); string strFilename = clsOutput.generateOutputFile(clsOutput.enumOutputType.PDF, htmlTemplate, style, Switch.propSwitchID, clsOutput.enumSwitchType.Portfolio); string strRecepient = IFA.propIFAEmail; string strSender = "*****@*****.**"; string strSubject = "Switch Instruction"; string strBody = clsEmail.generateEmailBody((Switch.propPortfolio.propConfirmationRequired ? "NotifyApprovedEmailReqSign" : "NotifyApprovedEmail"), null, null, null, null, null, Switch.propPortfolio.propCompany, Switch.propSwitchID.ToString()); clsEmail.SendWithAttachment(strRecepient, strSender, strSubject, strBody, Switch.propSwitchID, Switch.propClientID, clsEmail.enumEmailPurpose.ApproveSwitchNotification, strFilename); clsClient client = new clsClient(Switch.propClientID); string ClientName = client.propForename + " " + client.propSurname; if (!String.IsNullOrEmpty(client.propEmailWork)) { strRecepient = client.propEmailWork; strBody = clsEmail.generateEmailBody((Switch.propPortfolio.propConfirmationRequired ? "NotifyClientApprovedEmailReqSign" : "NotifyClientApprovedEmail"), null, null, ClientName, null, null, Switch.propPortfolio.propCompany, null); clsEmail.SendWithAttachment(strRecepient, strSender, strSubject, strBody, Switch.propSwitchID, Switch.propClientID, clsEmail.enumEmailPurpose.ApproveSwitchNotification, strFilename); } if (!String.IsNullOrEmpty(client.propEmailPersonal)) { strRecepient = client.propEmailPersonal; strBody = clsEmail.generateEmailBody((Switch.propPortfolio.propConfirmationRequired ? "NotifyClientApprovedEmailReqSign" : "NotifyClientApprovedEmail"), null, null, ClientName, null, null, Switch.propPortfolio.propCompany, null); clsEmail.SendWithAttachment(strRecepient, strSender, strSubject, strBody, Switch.propSwitchID, Switch.propClientID, clsEmail.enumEmailPurpose.ApproveSwitchNotification, strFilename); } }