コード例 #1
0
        /// <summary>
        /// Get all the liabilities of the customer
        /// </summary>
        /// <param name="customerIds"></param>
        /// <returns></returns>
        public DataSet GetLiabilities(string customerIds)
        {
            Database             db;
            DbCommand            cmdGetLiabilities;
            DataSet              dsGetLiabilities;
            int                  tempId            = 0;
            Calculator           calculator        = new Calculator();
            List <LiabilitiesVo> liabilitiesVoList = new List <LiabilitiesVo>();
            LiabilitiesVo        liabilityVo       = new LiabilitiesVo();
            LiabilitiesBo        liabilitiesBo     = new LiabilitiesBo();
            double               liabilityValue    = 0;

            try
            {
                db = DatabaseFactory.CreateDatabase("wealtherp");
                cmdGetLiabilities = db.GetStoredProcCommand("SP_RPT_GetLiabilities");
                db.AddInParameter(cmdGetLiabilities, "@PortfolioIds", DbType.String, customerIds);
                cmdGetLiabilities.CommandTimeout = 60 * 60;

                dsGetLiabilities = db.ExecuteDataSet(cmdGetLiabilities);
                if (dsGetLiabilities != null && dsGetLiabilities.Tables[0].Rows.Count > 0)
                {
                    for (int i = 0; i < dsGetLiabilities.Tables[0].Rows.Count; i++)
                    {
                        liabilityValue = 0;
                        liabilityVo    = liabilitiesBo.GetLiabilityDetails(int.Parse(dsGetLiabilities.Tables[0].Rows[i]["CL_LiabilitiesId"].ToString()));
                        if (liabilityVo.PaymentOptionCode == 1)
                        {
                            liabilityValue = liabilityValue + calculator.GetLoanOutstanding(liabilityVo.CompoundFrequency, liabilityVo.LoanAmount, liabilityVo.InstallmentStartDate, liabilityVo.InstallmentEndDate, 1, liabilityVo.LumpsumRepaymentAmount, liabilityVo.NoOfInstallments);
                        }
                        else if (liabilityVo.PaymentOptionCode == 2)
                        {
                            liabilityValue = liabilityValue + calculator.GetLoanOutstanding(liabilityVo.FrequencyCodeEMI, liabilityVo.LoanAmount, liabilityVo.InstallmentStartDate, liabilityVo.InstallmentEndDate, 2, liabilityVo.EMIAmount, liabilityVo.NoOfInstallments);
                        }
                        else
                        {
                            liabilityValue = liabilityVo.LoanAmount;
                        }
                        dsGetLiabilities.Tables[0].Rows[i]["LoanAmount"] = liabilityValue.ToString();
                    }
                }
            }
            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }
            catch (Exception Ex)
            {
                BaseApplicationException exBase       = new BaseApplicationException(Ex.Message, Ex);
                NameValueCollection      FunctionInfo = new NameValueCollection();
                FunctionInfo.Add("Method", "LiabilitiesDao.cs:GetLiabilities()");
                object[] objects = new object[1];
                objects[0]   = customerIds;
                FunctionInfo = exBase.AddObject(FunctionInfo, objects);
                exBase.AdditionalInformation = FunctionInfo;
                ExceptionManager.Publish(exBase);
                throw exBase;
            }
            return(dsGetLiabilities);
        }
コード例 #2
0
        protected void ddlAction_SelectedIndexChanged(object sender, EventArgs e)
        {
            string        menu;
            int           liabilityId = 0;
            LiabilitiesVo liabilityVo = new LiabilitiesVo();

            try
            {
                DropDownList MyDropDownList = (DropDownList)sender;
                GridViewRow  gvr            = (GridViewRow)MyDropDownList.NamingContainer;
                int          selectedRow    = gvr.RowIndex;
                liabilityId = int.Parse(gvLiabilities.DataKeys[selectedRow].Value.ToString());
                liabilityVo = liabilitiesBo.GetLiabilityDetails(liabilityId);

                menu = MyDropDownList.SelectedItem.Value.ToString();

                if (menu == "View")
                {
                    Session["menu"]        = "View";
                    Session["liabilityVo"] = liabilityVo;
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "leftpane", "loadcontrol('LiabilitiesMaintenanceForm','none');", true);
                }
                if (menu == "Edit")
                {
                    Session["menu"]        = "Edit";
                    Session["liabilityVo"] = liabilityVo;
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "leftpane", "loadcontrol('LiabilitiesMaintenanceForm','none');", true);
                }
            }
            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }
            catch (Exception Ex)
            {
                BaseApplicationException exBase       = new BaseApplicationException(Ex.Message, Ex);
                NameValueCollection      FunctionInfo = new NameValueCollection();
                FunctionInfo.Add("Method", "LiabilityView.ascx:ddlMenu_SelectedIndexChanged()");
                object[] objects = new object[2];
                objects[1]   = liabilityVo;
                objects[2]   = liabilityId;
                FunctionInfo = exBase.AddObject(FunctionInfo, objects);
                exBase.AdditionalInformation = FunctionInfo;
                ExceptionManager.Publish(exBase);
                throw exBase;
            }
        }
コード例 #3
0
        protected void ddlAction_SelectedIndexChanged(object sender, EventArgs e)
        {
            string        menu;
            int           liabilityId = 0;
            LiabilitiesVo liabilityVo = new LiabilitiesVo();

            try
            {
                RadComboBox  MyDropDownList = (RadComboBox)sender;
                GridDataItem gvr            = (GridDataItem)MyDropDownList.NamingContainer;
                int          selectedRow    = gvr.ItemIndex + 1;
                liabilityId = int.Parse(gvLiabilities.MasterTableView.DataKeyValues[selectedRow - 1]["LiabilityId"].ToString());
                liabilityVo = liabilitiesBo.GetLiabilityDetails(liabilityId);

                hdndeleteId.Value = liabilityId.ToString();
                menu = MyDropDownList.SelectedItem.Value.ToString();

                if (menu == "View")
                {
                    Session["menu"]        = "View";
                    Session["liabilityVo"] = liabilityVo;
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "leftpane", "loadcontrol('LiabilitiesMaintenanceForm','none');", true);
                }
                if (menu == "Edit")
                {
                    Session["menu"]        = "Edit";
                    Session["liabilityVo"] = liabilityVo;
                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "leftpane", "loadcontrol('LiabilitiesMaintenanceForm','none');", true);
                }
                if (menu == "Delete")
                {
                    Page.ClientScript.RegisterStartupScript(this.GetType(), "Message", "showmessage();", true);
                }
            }
            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }
        }