示例#1
0
        public byte[] generatePdf(string caseid, string url)
        {
            byte[] pdfData = null;

            try
            {
                //log start time generating pdf to db
                /*exceptionlog exLg = new exceptionlog();
                exLg.message = "starting time generating pdf before web service call = 0";
                exLg.source = caseid;
                exLg.stacktrace = DateTime.Now.ToString();
                exLg.targetsitename = "";
                dao.logException(exLg);
                Stopwatch stpwatch = Stopwatch.StartNew();*/

                //populate pdf byte array
                GeneratePdf genPdf = new GeneratePdf();
                MemoryStream output = genPdf.createPdf(caseid, url);
                pdfData = output.ToArray();

                //log end time generating pdf to db
                /*exLg = new exceptionlog();
                exLg.message = "ending time generating pdf before web service call = "+stpwatch.ElapsedMilliseconds;
                exLg.source = caseid;
                exLg.stacktrace = DateTime.Now.ToString();
                exLg.targetsitename = "";
                dao.logException(exLg);*/
            }
            catch (Exception excp)
            {
                //log exception to db
                exceptionlog exLog = new exceptionlog();
                exLog.message = excp.Message + " class: ActivityStatus Method: generatePdf Getting pdf byte array. activity id=" + caseid;
                exLog.source = excp.Source;

                string strtmp = excp.StackTrace;
                strtmp = strtmp.Replace('\r', ' ');
                strtmp = strtmp.Replace('\n', ' ');
                exLog.stacktrace = strtmp;

                exLog.targetsitename = excp.TargetSite.Name;

                dao.logException(exLog);
            }

            return pdfData;
        }
示例#2
0
        public static void MergeRows(GridView gridView)
        {
            try
            {
                string strPrevAsset = string.Empty;
                foreach (GridViewRow gvr in gridView.Rows)
                {
                    string strAsset = string.Empty;
                    Label tbAllocationPercent = (Label)gvr.FindControl("lblAssetClasses");

                    if (tbAllocationPercent != null && tbAllocationPercent.Text != string.Empty)
                    {
                        strAsset = tbAllocationPercent.Text;
                        if (strPrevAsset == strAsset)
                        {
                            tbAllocationPercent.Text = string.Empty;
                        }
                    }
                    strPrevAsset = strAsset;
                }
            }
            catch (Exception ex)
            {
                exceptionlog exLog = new exceptionlog();
                exLog.message = ex.Message + " class: GapSummary Method: MergeRows";
                exLog.source = ex.Source;

                string strtmp = ex.StackTrace;
                strtmp = strtmp.Replace('\r', ' ');
                strtmp = strtmp.Replace('\n', ' ');
                exLog.stacktrace = strtmp;

                exLog.targetsitename = ex.TargetSite.Name;

                ActivityStatusDAO activityStatus = new ActivityStatusDAO();
                activityStatus.logException(exLog);
            }
        }
示例#3
0
        public void cloneCase(string clonedFrom, string newId)
        {
            SqlConnection conn = DatabaseConnection.Connection.getConnection();

            try
            {
                SqlCommand cmdUpdMaster = new SqlCommand("CloneCase", conn);

                cmdUpdMaster.CommandType = CommandType.StoredProcedure;
                cmdUpdMaster.Parameters.Add(new SqlParameter("@CloneFromID", clonedFrom));
                cmdUpdMaster.Parameters.Add(new SqlParameter("@NewCaseID", newId));
                cmdUpdMaster.ExecuteNonQuery();
            }
            catch (Exception e)
            {
                //log exception to db
                exceptionlog exLog = new exceptionlog();
                exLog.message = e.Message + " class: ActivityStatusDAO Method: cloneCase";
                exLog.source = e.Source;

                string strtmp = e.StackTrace;
                strtmp = strtmp.Replace('\r', ' ');
                strtmp = strtmp.Replace('\n', ' ');
                exLog.stacktrace = strtmp;

                exLog.targetsitename = e.TargetSite.Name;

                logException(exLog);
            }
            finally
            {
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            lblStatusSubmissionFailed.Visible = false;
            lblStatusSubmitted.Visible = false;
            lblZurichAdvFailed.Visible = false;
            lblZurichAdvSuccess.Visible = false;

            activity = activityStatusDao.getActivity(13);
            ViewState["activity"] = activity;

            ZPlanResponseDataContract zPlanResponse = null;
            string clonedFrom = "";

            if (!IsPostBack)
            {

                /*string nextCaseId = Request.Form["caseid"];
                string menuCaseId = Request.QueryString["caseid"];

                if (nextCaseId != null && nextCaseId != "")
                {
                    caseid = nextCaseId;
                }

                if (menuCaseId != null && menuCaseId != "")
                {
                    caseid = menuCaseId;
                }*/

                string activityID = string.Empty;

                string country = string.Empty;
                if (Request.Form["Country"] != null)
                {
                    country = Request.Form["Country"].ToString();
                }

                string salesChannel = string.Empty;
                if (Request.Form["SalesChannel"] != null)
                {
                    salesChannel = Request.Form["SalesChannel"].ToString();
                }

                if (Request.Form["ActivityID"] != null)
                {
                    activityID = Request.Form["ActivityID"].ToString();
                    //activityID = "1500";

                    ZPlanDataContract zPlanContract = new ZPlanDataContract();
                    zPlanContract.ActivityId = activityID;
                    zPlanContract.Activity = ActivityTypeEnum.ZPlan;
                    zPlanContract.Action = ActionEnumContracts.View;
                    UserInfoEntity ufo = new UserInfoEntity();
                    ufo.Country = country;
                    ufo.RoleType = salesChannel;
                    zPlanContract.UserInfo = ufo;
                    zPlanResponse = new ZPlanResponseDataContract();

                    try
                    {
                        BusinessServiceClient client = new BusinessServiceClient();
                        client.ClientCredentials.Windows.AllowedImpersonationLevel =
                            System.Security.Principal.TokenImpersonationLevel.Impersonation;
                        zPlanResponse = client.ManageZPlan(zPlanContract);

                        if (zPlanResponse != null)
                        {
                            salesportalinfo salesPortalDto = new salesportalinfo();
                            salesPortalDto.activityid = activityID;
                            salesPortalDto.activitytype = zPlanResponse.ActivityType;
                            salesPortalDto.caseid = zPlanResponse.CaseId;
                            salesPortalDto.redirecturl = zPlanResponse.RedirectUrl;
                            salesPortalDto.roletype = zPlanResponse.RoleType;
                            salesPortalDto.salesportalurl = zPlanResponse.SalesPortalUrl;
                            salesPortalDto.userfirstname = zPlanResponse.UserFirstName;
                            salesPortalDto.userid = zPlanResponse.UserId;
                            salesPortalDto.userlastname = zPlanResponse.UserLastName;
                            salesPortalDto.usertype = zPlanResponse.UserType;
                            salesPortalDto.casestatus = zPlanResponse.CaseStatus;
                            salesPortalDto.country = country;
                            salesPortalDto.saleschannel = salesChannel;
                            activityStatusDao.saveSalesPortalInfo(activityID, salesPortalDto);

                            caseid = zPlanResponse.ActivityId;

                            //check if ClonedFrom is sent from portal
                            if (zPlanResponse.ClonedFrom != null && zPlanResponse.ClonedFrom != "")
                            {
                                clonedFrom = zPlanResponse.ClonedFrom;

                                //check if case has been cloned earlier
                                clonemappingid clonemapping = activityStatusDao.getCloneMappingForCaseid(clonedFrom, zPlanResponse.ActivityId);

                                if (clonemapping == null)
                                {
                                    //if the case is not cloned, add entry in the clone mapping table and clone the case
                                    clonemapping = new clonemappingid();
                                    clonemapping.clonedfrom = clonedFrom;
                                    clonemapping.newid = zPlanResponse.ActivityId;
                                    activityStatusDao.saveClonemapping(clonemapping);

                                    activityStatusDao.cloneCase(clonedFrom, zPlanResponse.ActivityId);
                                }

                            }

                        }
                    }
                    catch (Exception ex)
                    {
                        //log exception to db
                        exceptionlog exLog = new exceptionlog();
                        exLog.message = ex.Message + " class: MyZurichAdviser Method: Page_Load";
                        exLog.source = ex.Source;

                        string strtmp = ex.StackTrace;
                        strtmp = strtmp.Replace('\r', ' ');
                        strtmp = strtmp.Replace('\n', ' ');
                        exLog.stacktrace = strtmp;

                        exLog.targetsitename = ex.TargetSite.Name;

                        activityStatusDao.logException(exLog);
                    }

                }
                else
                {
                    string backCaseId = Request.Form["caseid"];
                    string menuCaseId = Request.QueryString["caseid"];

                    if (backCaseId != null && backCaseId != "")
                    {
                        caseid = backCaseId;
                    }
                    else if (menuCaseId != null && menuCaseId != "")
                    {
                        caseid = menuCaseId;
                    }
                    else if (Session["fnacaseid"] != null)
                    {
                        caseid = Session["fnacaseid"].ToString();
                    }
                    else
                    {
                        caseid = "2040";
                    }

                }

                activityId.Value = caseid;
                PersonalDetailsDAO dao = new PersonalDetailsDAO();
                personaldetail detail = dao.getPersonalDetail(caseid);

                if (detail != null)
                {
                    if (zPlanResponse != null)
                    {
                        detail.datepicker = zPlanResponse.Dob;
                        detail.gender = zPlanResponse.Gender;
                        //detail.maritalstatus = zPlanResponse.MaritalStatus;
                        detail.name = zPlanResponse.UserFirstName;
                        detail.surname = zPlanResponse.UserLastName;
                        detail.nationality = zPlanResponse.Nationality;
                        detail.nric = zPlanResponse.NricOrPassport;
                        detail.occupation = zPlanResponse.Occupation;
                        if (zPlanResponse.Smoker)
                        {
                            detail.issmoker = "Yes";
                        }
                        else
                        {
                            detail.issmoker = "No";
                        }
                        detail.title = zPlanResponse.Title;
                    }

                    dao.updatePersonalDetails(detail);
                }
                else
                {
                    detail = new personaldetail();
                    detail.caseid = caseid;

                    if (zPlanResponse != null)
                    {
                        detail.datepicker = zPlanResponse.Dob;
                        detail.gender = zPlanResponse.Gender;
                        //detail.maritalstatus = zPlanResponse.MaritalStatus;
                        detail.name = zPlanResponse.UserFirstName;
                        detail.surname = zPlanResponse.UserLastName;
                        detail.nationality = zPlanResponse.Nationality;
                        detail.nric = zPlanResponse.NricOrPassport;
                        detail.occupation = zPlanResponse.Occupation;
                        if (zPlanResponse.Smoker)
                        {
                            detail.issmoker = "Yes";
                        }
                        else
                        {
                            detail.issmoker = "No";
                        }
                        detail.title = zPlanResponse.Title;
                    }
                    dao.savePersonalDetails(detail);
                }

                if (caseid != "")
                {
                    ViewState["caseid"] = caseid;

                    List<myzurichadviser> savedMzaoptions = mzaDao.getMza(caseid);

                    if (savedMzaoptions != null && savedMzaoptions.Count>0)
                    {
                        ViewState["casetype"] = "update";
                    }
                    else
                    {
                        ViewState["casetype"] = "new";
                        savedMzaoptions = new List<myzurichadviser>();
                        myzurichadviser mzadv = new myzurichadviser();
                        mzadv.caseid = caseid;
                        mzadv.selectedoptionid = 1;
                        savedMzaoptions.Add(mzadv);

                        mzadv = new myzurichadviser();
                        mzadv.caseid = caseid;
                        mzadv.selectedoptionid = 2;
                        savedMzaoptions.Add(mzadv);
                    }

                    populateMzaoptions(savedMzaoptions, caseid);

                }

            }
            markStatusOnTab(caseid);
        }
        private void populateRetirementGoal(retirementgoal retirementGoalSelf, assumption inflationAdjustedReturnAsmptn, assumption annualInflationReturn, string caseid)
        {
            double shortfallSurplusSelf = 0;
            int iIntendedRetirementAge = 0;

            PersonalDetailsDAO dao = new PersonalDetailsDAO();
            personaldetail detail = dao.getPersonalDetail(caseid);

            int yrDob = 0;
            int currentYr = DateTime.Now.Year;
            int agePolicyOwner = 0;
            int iYrstoRetirement = 0;

            try
            {
                DateTime dt2 = DateTime.ParseExact(detail.datepicker, "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture);
                yrDob = dt2.Year;

                if (DateTime.Now.Month < dt2.Month)
                {
                    agePolicyOwner = currentYr - yrDob - 1;
                }
                else if (DateTime.Now.Month > dt2.Month)
                {
                    agePolicyOwner = currentYr - yrDob;
                }
                else
                {
                    if (DateTime.Now.Day < dt2.Day)
                    {
                        agePolicyOwner = currentYr - yrDob - 1;
                    }
                    else if ((DateTime.Now.Day > dt2.Day) || (DateTime.Now.Day == dt2.Day))
                    {
                        agePolicyOwner = currentYr - yrDob;
                    }
                }

                iYrstoRetirement = iIntendedRetirementAge - agePolicyOwner;
            }
            catch (Exception e)
            {
                //log exception to db
                exceptionlog exLog = new exceptionlog();
                exLog.message = e.Message + " class: ShowRetirementGoals Method: populateRetirementGoal setting yrs to retirement";
                exLog.source = e.Source;

                string strtmp = e.StackTrace;
                strtmp = strtmp.Replace('\r', ' ');
                strtmp = strtmp.Replace('\n', ' ');
                exLog.stacktrace = strtmp;

                exLog.targetsitename = e.TargetSite.Name;

                activityStatusDao.logException(exLog);
            }
            pownerdob.Value = agePolicyOwner.ToString();

            if (detail != null)
            {
                pownergender.Value = detail.gender;
            }

            IncomeExpenseDAO iedao = new IncomeExpenseDAO();
            incomeExpense iedetail = iedao.getIncomeExpenseForCase(caseid);

            retirementGoalNeeded2.Selected = true;

            //populate self retirement goals
            if (retirementGoalSelf != null)
            {
                retirementGoalNeeded.SelectedValue = retirementGoalSelf.retirementGoalNeeded.ToString();

                if (retirementGoalSelf.intendedretirementage != null && retirementGoalSelf.intendedretirementage != "")
                {
                    intendedRetirementAge.Text = retirementGoalSelf.intendedretirementage;
                }
                else
                {
                    intendedRetirementAge.Text = "62";
                }
                iIntendedRetirementAge = Int32.Parse(intendedRetirementAge.Text);

                //expectedRetirementAgelbl.Text = intendedRetirementAge.Text;

                if (retirementGoalSelf.incomerequired != null && retirementGoalSelf.incomerequired != "")
                {
                    incomeRequiredUponRetirement.Text = retirementGoalSelf.incomerequired;
                }
                else
                {
                    double dincomeReq = 0;
                    if (iedetail!=null && iedetail.netMonthlyIncomeAfterCpf != null && iedetail.netMonthlyIncomeAfterCpf != "")
                    {
                        dincomeReq = 0.7 * 12 * double.Parse(iedetail.netMonthlyIncomeAfterCpf);
                    }

                    incomeRequiredUponRetirement.Text = Math.Round(dincomeReq, 2).ToString();
                }

                //presentIncomeNeededlbl.Text = incomeRequiredUponRetirement.Text;

                if (retirementGoalSelf.yrstoretirement != null && retirementGoalSelf.yrstoretirement != "")
                {
                    yearsToRetirement.Text = retirementGoalSelf.yrstoretirement;
                }
                else
                {
                    yearsToRetirement.Text = iYrstoRetirement.ToString();
                }

                //currentAgelbl.Text = (double.Parse(intendedRetirementAge.Text) - double.Parse(yearsToRetirement.Text)).ToString();

                if (retirementGoalSelf.inflationrate == null || retirementGoalSelf.inflationrate == "")
                {
                    if (annualInflationReturn != null)
                    {
                        annualInflationRate.Text = annualInflationReturn.percentage.Value.ToString();
                    }
                    else
                    {
                        annualInflationRate.Text = "0";
                    }
                }
                else
                {
                    annualInflationRate.Text = retirementGoalSelf.inflationrate;
                }

                //inflationRatelbl.Text = annualInflationRate.Text;

                if (retirementGoalSelf.futureincome != null && retirementGoalSelf.futureincome != "")
                {
                    futureIncomeNeeded.Text = retirementGoalSelf.futureincome;
                }
                else
                {
                    futureIncomeNeeded.Text = "0";
                }

                //futureIncomeNeededChartlbl.Text = futureIncomeNeeded.Text;

                if (retirementGoalSelf.sourcesofincome != null && retirementGoalSelf.sourcesofincome != "")
                {
                    sourcesOfIncome.Text = retirementGoalSelf.sourcesofincome;
                }
                else
                {
                    sourcesOfIncome.Text = "0";
                }

                if (retirementGoalSelf.totalfirstyrincome != null && retirementGoalSelf.totalfirstyrincome != "")
                {
                    totalFirstYearIncomeNeeded.Text = retirementGoalSelf.totalfirstyrincome;
                }
                else
                {
                    totalFirstYearIncomeNeeded.Text = "0";
                }

                //annualAmountlbl.Text = totalFirstYearIncomeNeeded.Text;

                if (retirementGoalSelf.inflationreturnrate == null || retirementGoalSelf.inflationreturnrate == "")
                {
                    if (inflationAdjustedReturnAsmptn != null)
                    {
                        inflationAdjustedReturn.Text = inflationAdjustedReturnAsmptn.percentage.Value.ToString();
                    }
                    else
                    {
                        inflationAdjustedReturn.Text = "0";
                    }
                }
                else
                {
                    inflationAdjustedReturn.Text = retirementGoalSelf.inflationreturnrate;
                }

                //inflationAdjustedReturnslbl.Text = inflationAdjustedReturn.Text;

                if (retirementGoalSelf.durationretirement != null && retirementGoalSelf.durationretirement != "")
                {
                    durationOfRetirement.Text = retirementGoalSelf.durationretirement;
                }
                else
                {
                    int iDurationofRetirement = 0;

                    if (detail.gender == "Male")
                    {
                        iDurationofRetirement = 83 - iIntendedRetirementAge;
                    }
                    else if (detail.gender == "Female")
                    {
                        iDurationofRetirement = 88 - iIntendedRetirementAge;
                    }

                    durationOfRetirement.Text = iDurationofRetirement.ToString();
                }

                //durationOfRetirementValuelbl.Text = durationOfRetirement.Text;
                //ageAtEndOfRetirementlbl.Text = (double.Parse(durationOfRetirement.Text) + double.Parse(intendedRetirementAge.Text)).ToString();

                if (retirementGoalSelf.lumpsumrequired != null && retirementGoalSelf.lumpsumrequired != "")
                {
                    lumpSumRequiredAtRetirement.Text = retirementGoalSelf.lumpsumrequired;
                }
                else
                {
                    lumpSumRequiredAtRetirement.Text = "0";
                }

                if (retirementGoalSelf.maturityvalue != null && retirementGoalSelf.maturityvalue != "")
                {
                    maturityValue2.Text = retirementGoalSelf.maturityvalue;
                }
                else
                {
                    maturityValue2.Text = "0";
                }

                assetListSelf.DataSource = retirementGoalSelf.existingassetrgs;
                assetListSelf.DataBind();

                if (retirementGoalSelf.existingassetrgs != null)
                {
                    ViewState["noofassets"] = retirementGoalSelf.existingassetrgs.Count;
                    if (retirementGoalSelf.existingassetstotal != null && retirementGoalSelf.existingassetstotal != "")
                    existingAssets2.Text = retirementGoalSelf.existingassetstotal;
                    else
                        existingAssets2.Text = "0";

                }

                shortfallSurplusSelf = double.Parse(existingAssets2.Text) + double.Parse(maturityValue2.Text) - double.Parse(lumpSumRequiredAtRetirement.Text);
                if (shortfallSurplusSelf < 0)
                {
                    ttlSSSelf.Text = "Shortfall";
                    ttlSSSelf.Style.Add("color", "red");
                }
                else if (shortfallSurplusSelf > 0)
                {
                    ttlSSSelf.Text = "Surplus";
                    ttlSSSelf.Style.Add("color", "black");
                }
                else
                {
                    ttlSSSelf.Text = "Total (Shortfall / Surplus)";
                    ttlSSSelf.Style.Add("color", "black");
                }

                totalShortfallSurplus2.Text = Math.Abs(shortfallSurplusSelf).ToString();
            }

            activityId.Value = caseid;
        }
示例#6
0
        public void saveSalesPortalInfo(string caseid, salesportalinfo salesPortalInfo)
        {
            salesportalinfo spistatus = null;

            try
            {
                dbDataContext ct = new dbDataContext();

                //retrieve existing sales portal info
                var querySalesPortalInfo = from spi in ct.salesportalinfos
                                          where spi.activityid == caseid
                                          select spi;

                foreach (salesportalinfo a in querySalesPortalInfo)
                {
                    spistatus = a;
                }
                if (spistatus == null)
                {
                    //adding new sales portal info
                    ct.salesportalinfos.InsertOnSubmit(salesPortalInfo);
                }
                else
                {
                    //update sales portal info
                    spistatus.activitytype = salesPortalInfo.activitytype;
                    spistatus.caseid = salesPortalInfo.caseid;
                    spistatus.redirecturl = salesPortalInfo.redirecturl;
                    spistatus.roletype = salesPortalInfo.roletype;
                    spistatus.salesportalurl = salesPortalInfo.salesportalurl;
                    spistatus.userfirstname = salesPortalInfo.userfirstname;
                    spistatus.userid = salesPortalInfo.userid;
                    spistatus.userlastname = salesPortalInfo.userlastname;
                    spistatus.usertype = salesPortalInfo.usertype;
                    spistatus.casestatus = salesPortalInfo.casestatus;
                    spistatus.country = salesPortalInfo.country;
                    spistatus.saleschannel = salesPortalInfo.saleschannel;
                }

                ct.SubmitChanges();
            }
            catch (Exception e)
            {
                //log exception to db
                exceptionlog exLog = new exceptionlog();
                exLog.message = e.Message + " class: ActivityStatusDAO Method: saveSalesPortalInfo";
                exLog.source = e.Source;

                string strtmp = e.StackTrace;
                strtmp = strtmp.Replace('\r', ' ');
                strtmp = strtmp.Replace('\n', ' ');
                exLog.stacktrace = strtmp;

                exLog.targetsitename = e.TargetSite.Name;

                logException(exLog);
            }
        }
示例#7
0
        public void saveClonemapping(clonemappingid clonemapping)
        {
            try
            {
                dbDataContext db = new dbDataContext();
                db.clonemappingids.InsertOnSubmit(clonemapping);
                db.SubmitChanges();
            }
            catch (Exception e)
            {
                //log exception to db
                exceptionlog exLog = new exceptionlog();
                exLog.message = e.Message + " class: ActivityStatusDAO Method: saveClonemapping";
                exLog.source = e.Source;

                string strtmp = e.StackTrace;
                strtmp = strtmp.Replace('\r', ' ');
                strtmp = strtmp.Replace('\n', ' ');
                exLog.stacktrace = strtmp;

                exLog.targetsitename = e.TargetSite.Name;

                logException(exLog);
            }
        }
示例#8
0
 public void logException(exceptionlog exLog)
 {
     try
     {
         dbDataContext db = new dbDataContext();
         db.exceptionlogs.InsertOnSubmit(exLog);
         db.SubmitChanges();
     }
     catch (Exception e)
     {
         string str = e.Message;
     }
 }
示例#9
0
        public salesportalinfo getSalesPortalInfoForCaseid(string caseid)
        {
            salesportalinfo salesPortalInfo = null;

            try
            {
                dbDataContext ct = new dbDataContext();
                var querySalesInfo = from spi in ct.salesportalinfos
                                    where spi.activityid == caseid
                                    select spi;
                foreach (salesportalinfo a in querySalesInfo)
                {
                    salesPortalInfo = a;
                }

            }
            catch (Exception e)
            {
                //log exception to db
                exceptionlog exLog = new exceptionlog();
                exLog.message = e.Message + " class: ActivityStatusDAO Method: getSalesPortalInfoForCaseid";
                exLog.source = e.Source;

                string strtmp = e.StackTrace;
                strtmp = strtmp.Replace('\r', ' ');
                strtmp = strtmp.Replace('\n', ' ');
                exLog.stacktrace = strtmp;

                exLog.targetsitename = e.TargetSite.Name;

                logException(exLog);
            }

            return salesPortalInfo;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            activity = activityStatusDao.getActivity(11);
            ViewState["activity"] = activity;

            premium.Style["TEXT-ALIGN"] = TextAlign.Right.ToString();
            txtTotalPremium.Style["TEXT-ALIGN"] = TextAlign.Right.ToString();
            txtAllocationAmtTotal.Style["TEXT-ALIGN"] = TextAlign.Right.ToString();
            lblTotal.Style["TEXT-ALIGN"] = TextAlign.Right.ToString();
            //followAssetAllocationOnRiskProfile.Attributes.Add("onclick", "return confirm('Data will be lost when?');");
            //nonCoreFunds.Attributes.Add("onclick", "return confirm('Are you sure?');");
            //allocationBasedOnRiskProfile.Attributes.Add("onclick", "return confirm('Are you sure?');");
            //optnAgreeRiskProfile.Attributes.Add("onclick", "showChangeRiskProfileMessage();");

            premium.Attributes.Add("onblur", "roundOffValues();");
            txtTotalPremium.Attributes.Add("onblur", "roundOffValues();");
            txtAllocationAmtTotal.Attributes.Add("onblur", "roundOffValues();");
               // txtTotalPremium.Attributes.Add("OnKeyPress", "DisableTyping();");
            txtTotalPremium.BackColor = Color.LightGray;
            txtAllocationAmtTotal.BackColor = Color.LightGray;

            try
            {
                if (!IsPostBack)
                {
                    string menuCaseId = Request.QueryString["caseid"];

                    if (Session["fnacaseid"] != null)
                    {
                        caseID = Session["fnacaseid"].ToString();
                    }

                    if (menuCaseId != null && menuCaseId != "")
                    {
                        caseID = menuCaseId;
                    }

                    ViewState["caseid"] = caseID;
                    activityId.Value = caseID;

                    HideFieldsOnFormLoad();

                    string strLclRiskProfileName = LoadRiskProfileDetails(caseID);
                    if (strLclRiskProfileName == null || strLclRiskProfileName == string.Empty)
                    {
                        EnableDisableControls(false);
                        btnBackFundPlotter.Enabled = true;
                        btnNextFundPlotter.Enabled = true;
                        btnBackPortFolioModel.Enabled = true;
                        btnNextPortFolioModel.Enabled = true;
                        return;
                    }
                    else
                    {
                        EnableDisableControls(true);
                    }

                    if (ViewState["strProfileName"] != null)
                    {
                        strProfileName = ViewState["strProfileName"].ToString();
                    }

                    if (ViewState["strRiskProfileID"] != null)
                    {
                        strRiskProfileID = ViewState["strRiskProfileID"].ToString();
                    }

                    LoadPortFolioDetails();

                    if ((txtTotalPremium.Text != string.Empty && (Convert.ToInt32(txtTotalPremium.Text) < 100))
                         && !(optnAgreeRiskProfileNo.Selected == true && ddlRiskProfileList.SelectedIndex == 1))
                    {
                        //if (lblSubmitMessageLessThan100.Visible == false)
                        //{
                        if (optnAgreeRiskProfileYes.Selected == true && lblRiskProfile.Text == "Capital Preservation")
                        {
                            lblAllocationLessThan100.Visible = false;
                        }
                        else
                        {
                            lblAllocationLessThan100.Visible = true;
                        }
                        //}
                    }
                }
                else
                {
                    if (ViewState["caseid"] != null)
                    {
                        caseID = ViewState["caseid"].ToString();
                    }

                    if (ViewState["strProfileName"] != null)
                    {
                        strProfileName = ViewState["strProfileName"].ToString();
                    }

                    if (ViewState["strRiskProfileID"] != null)
                    {
                        strRiskProfileID = ViewState["strRiskProfileID"].ToString();
                    }
                }

                cst.Value = markStatusOnTab(caseID);
            }
            catch (Exception ex)
            {
                exceptionlog exLog = new exceptionlog();
                exLog.message = ex.Message + " class: PortFolioModelling Method: Page_Load";
                exLog.source = ex.Source;

                string strtmp = ex.StackTrace;
                strtmp = strtmp.Replace('\r', ' ');
                strtmp = strtmp.Replace('\n', ' ');
                exLog.stacktrace = strtmp;

                exLog.targetsitename = ex.TargetSite.Name;

                ActivityStatusDAO activityStatus = new ActivityStatusDAO();
                activityStatus.logException(exLog);
            }
        }
示例#11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            lblGapSummarySaveSuccess.Visible = false;
            lblGapSummarySaveFailed.Visible = false;
            lblPrioritiesSequence.Visible = false;
            lblNotNumeric.Visible = false;

            try
            {
                if (!IsPostBack)
                {
                    string menuCaseId = Request.QueryString["caseid"];

                    if (Session["fnacaseid"] != null)
                    {
                        caseID = Session["fnacaseid"].ToString();
                    }

                    if (menuCaseId != null && menuCaseId != "")
                    {
                        caseID = menuCaseId;
                    }

                    ViewState["caseid"] = caseID;
                    activityId.Value = caseID;

                    LoadGapSummary();
                }
                else
                {
                    if (ViewState["caseid"] != null)
                    {
                        caseID = ViewState["caseid"].ToString();
                    }
                }
            }
            catch (Exception ex)
            {
                exceptionlog exLog = new exceptionlog();
                exLog.message = ex.Message + " class: GapSummary Method: Page_Load";
                exLog.source = ex.Source;

                string strtmp = ex.StackTrace;
                strtmp = strtmp.Replace('\r', ' ');
                strtmp = strtmp.Replace('\n', ' ');
                exLog.stacktrace = strtmp;

                exLog.targetsitename = ex.TargetSite.Name;

                activityStatusDao.logException(exLog);
            }
        }
        private bool savePortFolioModel()
        {
            try
            {
                if ((optnAgreeRiskProfileYes.Selected == true && lblRiskProfile.Text != "Capital Preservation") || (optnAgreeRiskProfileNo.Selected == true && ddlRiskProfileList.SelectedIndex > 1))
                {
                    if (!validateAllRequiredFields())
                    {
                        return false;
                    }
                }

                int riskProfileId = -1;
                switch (strProfileName)
                {
                    case "Capital Preservation":
                        riskProfileId = 0;
                        break;
                    case "Cautious":
                        riskProfileId = 1;
                        break;
                    case "Moderately Cautious":
                        riskProfileId = 2;
                        break;
                    case "Balanced":
                        riskProfileId = 3;
                        break;
                    case "Moderately Adventurous":
                        riskProfileId = 4;
                        break;
                    case "Adventurous":
                        riskProfileId = 5;
                        break;
                    default:
                        break;
                }

                bool agreeRiskProfile = true;
                if (optnAgreeRiskProfileYes.Selected == true)
                {
                    agreeRiskProfile = true;
                }
                if (optnAgreeRiskProfileNo.Selected == true)
                {
                    agreeRiskProfile = false;
                }

                string newRiskProfile = "-1";
                newRiskProfile = ddlRiskProfileList.SelectedValue.ToString();

                bool followAssetAllocationOnRiskProfileYesNo = false;
                if (optnAssetAllocRiskProfile1.Selected == true)
                {
                    followAssetAllocationOnRiskProfileYesNo = true;
                }
                if (optnAssetAllocRiskProfile2.Selected == true)
                {
                    followAssetAllocationOnRiskProfileYesNo = false;
                }

                //True = Fund Risk Plottor, False = Fund Selection
                bool assetAllocationOnRiskProfileYesNo = false;
                if (optnAllocRiskProfile1.Selected == true)
                {
                    assetAllocationOnRiskProfileYesNo = true;
                }
                if (optnAllocRiskProfile2.Selected == true)
                {
                    assetAllocationOnRiskProfileYesNo = false;
                }

                bool includeNonCoreFundsYesNo = false;
                if (optnNonCoreFunds1.Selected == true)
                {
                    includeNonCoreFundsYesNo = true;
                }
                if (optnNonCoreFunds2.Selected == true)
                {
                    includeNonCoreFundsYesNo = false;
                }

                int premiumSelect = -1;
                if (optnPremiumSelect1.Selected == true)
                {
                    premiumSelect = 0;
                }
                if (optnPremiumSelect2.Selected == true)
                {
                    premiumSelect = 1;
                }

                double premiumAmount = 0;
                double premiumPercent = 0;
                double totalPremiumAmount = 0;
                if (premium.Text != null && premium.Text != "")
                {
                    premiumAmount = Convert.ToDouble(premium.Text);
                }

                string paymentMode = "-1";
                paymentMode = ddlPaymentMode.SelectedValue.ToString();

                List<int> lstAssetId = new List<int>();
                List<int> lstFundId = new List<int>();
                List<int> lstAllocationPercent = new List<int>();
                List<int> lstAmount = new List<int>();

                DataTable dtPortFolioBuilderDetail = new DataTable();
                dtPortFolioBuilderDetail.Columns.Add("AssetId", typeof(string));
                dtPortFolioBuilderDetail.Columns.Add("FundId", typeof(string));
                dtPortFolioBuilderDetail.Columns.Add("AllocationPercent", typeof(string));
                dtPortFolioBuilderDetail.Columns.Add("Amount", typeof(string));

                List<GridViewRow> gvRows = new List<GridViewRow>();
                if (optnAssetAllocRiskProfile1.Selected == true && (optnNonCoreFunds1.Selected == true || optnNonCoreFunds2.Selected == true))
                {
                    if (!validateFundAllocation())
                    {
                        return false;
                    }
                    foreach (GridViewRow gvRow in grdNonCoreFunds.Rows)
                    {
                        gvRows.Add(gvRow);
                    }
                }
                if (optnAssetAllocRiskProfile2.Selected == true && optnAllocRiskProfile1.Selected == true)
                {
                    if (!validateFundPlotter())
                    {
                        return false;
                    }
                    foreach (GridViewRow gvRow in grdFundRiskPlotter.Rows)
                    {
                        gvRows.Add(gvRow);
                    }
                    foreach (GridViewRow gvRow in grdSecondaryFunds.Rows)
                    {
                        gvRows.Add(gvRow);
                    }
                }
                if (optnAssetAllocRiskProfile2.Selected == true && optnAllocRiskProfile2.Selected == true)
                {
                    if (!ValidateFundSelection())
                    {
                        return false;
                    }
                    foreach (GridViewRow gvRow in grdFundsSelection.Rows)
                    {
                        gvRows.Add(gvRow);
                    }
                }

                if (gvRows != null)
                {
                    foreach (GridViewRow gvr in gvRows)
                    {
                        Label lblAssedId = (Label)gvr.FindControl("lblAssetId");
                        Label lblFundId = (Label)gvr.FindControl("lblFundId");
                        TextBox tbAllocationPercent = (TextBox)gvr.FindControl("txtAllocation");
                        TextBox tbAmount = (TextBox)gvr.FindControl("txtAmount");

                        string iAssetId = lblAssedId.Text;
                        string iFundId = lblFundId.Text;
                        string strAllocationPercent = tbAllocationPercent.Text;
                        string strAmount = tbAmount.Text;
                        double totalPercent = 0;
                        double totalpremiumAmt = 0;

                        if ((strAllocationPercent != null && strAllocationPercent != "" && Convert.ToDouble(strAllocationPercent) > 0) ||
                            (strAmount != null && strAmount != "" && Convert.ToDouble(strAmount) > 0))
                        {
                            if (strAllocationPercent == null || strAllocationPercent == "")
                            {
                                strAllocationPercent = "0";
                            }
                            if ( Convert.ToDouble(strAllocationPercent) == 0)
                            {
                                continue;
                            }
                            //{
                            totalPercent = Convert.ToDouble(strAllocationPercent);
                            //}
                            if (strAmount == null || strAmount == "")
                            {
                                strAmount = "0";
                            }
                            //else
                            //{
                            totalpremiumAmt = Convert.ToDouble(strAmount);
                            //}
                            dtPortFolioBuilderDetail.Rows.Add(iAssetId, iFundId, strAllocationPercent, strAmount);
                        }

                        premiumPercent = premiumPercent + totalPercent;
                        totalPremiumAmount = totalPremiumAmount + totalpremiumAmt;
                        //if (txtTotalPremium.Text != null && txtTotalPremium.Text != "")
                        //{
                        //premiumPercent = Convert.ToDouble(txtTotalPremium.Text);
                        //}
                    }

                    PortFolioModellingDAO portFolioDAO = new PortFolioModellingDAO();
                    bool bResult = portFolioDAO.SavePortFolioBuilderInfo(caseID,
                                                                        riskProfileId,
                                                                        agreeRiskProfile,
                                                                        newRiskProfile,
                                                                        followAssetAllocationOnRiskProfileYesNo,
                                                                        assetAllocationOnRiskProfileYesNo,
                                                                        includeNonCoreFundsYesNo,
                                                                        premiumSelect,
                                                                        premiumAmount,
                                                                        paymentMode,
                                                                        premiumPercent,
                                                                        totalPremiumAmount,
                                                                        dtPortFolioBuilderDetail);

                    if (bResult)
                    {
                        string actv = "";
                        if (ViewState["activity"] != null)
                        {
                            actv = ViewState["activity"].ToString();
                        }

                        string status = activityStatusCheck.getPortfolioBuilderStatus(premiumPercent);
                        activityStatusDao.saveOrUpdateActivityStatus(caseID, actv, status);

                        cst.Value = markStatusOnTab(caseID);
                        ScriptManager.RegisterStartupScript(this, typeof(string), "TabStatus", "tabstatus('"+cst.Value+"');", true);

                        string caseStatus = activityStatusCheck.getZPlanStatus(caseID);

                        string url = Server.MapPath("~/_layouts/Zurich/Printpages/");
                        pdfData = activityStatusCheck.sendDataToSalesPortal(caseID, caseStatus, url, sendPdf);

                        LoadPortFolioDetails();

                        if ((txtTotalPremium.Text != string.Empty && (Convert.ToInt32(txtTotalPremium.Text) < 100))
                            && !(optnAgreeRiskProfileNo.Selected == true && ddlRiskProfileList.SelectedIndex == 1))
                        {
                            lblSubmitMessageLessThan100.Visible = true;
                            lblSubmitMessage.Visible = false;
                        }
                        else
                        {
                            lblSubmitMessageLessThan100.Visible = false;
                            lblSubmitMessage.Visible = true;
                        }

                        return true;
                    }
                }
            }
            catch (Exception ex)
            {
                exceptionlog exLog = new exceptionlog();
                exLog.message = ex.Message + " class: PortFolioModelling Method: SavePortFolioModel";
                exLog.source = ex.Source;

                string strtmp = ex.StackTrace;
                strtmp = strtmp.Replace('\r', ' ');
                strtmp = strtmp.Replace('\n', ' ');
                exLog.stacktrace = strtmp;

                exLog.targetsitename = ex.TargetSite.Name;

                ActivityStatusDAO activityStatus = new ActivityStatusDAO();
                activityStatus.logException(exLog);
            }

            return false;
        }
示例#13
0
        private void logException(Exception ex, string methodName)
        {
            exceptionlog exLog = new exceptionlog();
            exLog.message = ex.Message + " class: PortFolioModellingDAO Method: " + methodName;
            exLog.source = ex.Source;

            string strtmp = ex.StackTrace;
            strtmp = strtmp.Replace('\r', ' ');
            strtmp = strtmp.Replace('\n', ' ');
            exLog.stacktrace = strtmp;

            exLog.targetsitename = ex.TargetSite.Name;

            ActivityStatusDAO activityStatus = new ActivityStatusDAO();
            activityStatus.logException(exLog);
        }
示例#14
0
 partial void Deleteexceptionlog(exceptionlog instance);
示例#15
0
 partial void Updateexceptionlog(exceptionlog instance);
示例#16
0
 partial void Insertexceptionlog(exceptionlog instance);