Esempio n. 1
0
        private void FillIntPaymentDetailGrid(string sInterestClaimTransNo)
        {
            InterestClaimDAL intClaimDAL = new InterestClaimDAL();
            ClaimDAL         claimDAL    = new ClaimDAL();
            Config           oConfig     = (Config)Session[Constants.SES_USER_CONFIG];

            /////Currency Update
            string sCurrecncyCriteria = " INNER JOIN (SELECT     TOP (1) PolicyID, MAX(PolicyEffectDate) AS PolicyEffectDate FROM SPMS_SPPolicy WHERE (SPTypeID = '" + ddlSpType.SelectedValue + "') GROUP BY PolicyID ORDER BY PolicyEffectDate DESC) AS b INNER JOIN SPMS_SPCurrencyPolicy ON b.PolicyID = SPMS_SPCurrencyPolicy.PolicyID ON a.CurrencyID = SPMS_SPCurrencyPolicy.CurrencyID ";

            sCurrecncyCriteria += " WHERE (SPMS_SPCurrencyPolicy.ActivityType = " + (int)Constants.ACTIVITY_TYPE.INTEREST_CLAIM + ")";

            DataTable dtCurrencySource = claimDAL.GetCurrencySource(sCurrecncyCriteria);

            if (dtCurrencySource != null)
            {
                ddlConversionCurrency.DataSource     = dtCurrencySource;
                ddlConversionCurrency.DataTextField  = "DisplayMember";
                ddlConversionCurrency.DataValueField = "ValueMember";
                ddlConversionCurrency.DataBind();
                ddlConversionCurrency.Enabled = false;
            }

            string sSPCurrency = ViewState[_SPTYPE_CUREENCY] as string;

            if (string.IsNullOrEmpty(sSPCurrency))
            {
                sSPCurrency = claimDAL.GetSPCurrency(ddlSpType.SelectedValue);
            }

            ViewState[_SPTYPE_CUREENCY] = sSPCurrency;//claimDAL.GetSPCurrency(ddlSpType.SelectedValue);

            LoadCurrencyData();
            ////


            string reportType = "";

            reportType = ddlReportCategory.SelectedValue;
            Result oResult = intClaimDAL.GetInterestClaimData(ddlSpType.SelectedValue, Util.GetDateTimeByString(txtPaymentDateFrom.Text), Util.GetDateTimeByString(txtPaymentDateTo.Text), reportType, sInterestClaimTransNo, oConfig.DivisionID, oConfig.BankCodeID);

            if (oResult.Status)
            {
                DataTable dtIntClaim = oResult.Return as DataTable;

                if (dtIntClaim != null && dtIntClaim.Rows.Count > 0)
                {
                    hdnGridTotal.Value = dtIntClaim.Rows.Count.ToString();

                    dtIntClaim.Columns.Remove("CurrencyID");
                    dtIntClaim.Columns.Remove("InterestRate");
                    dtIntClaim.Columns.Remove("PaidInterestA");
                    dtIntClaim.Columns.Remove("IncomeTaxA");
                    dtIntClaim.Columns.Remove("PaymentAmountA");

                    gvData.DataSource = dtIntClaim;
                    gvData.DataBind();

                    DDListUtil.Assign(ddlConversionCurrency, Convert.ToString(dtIntClaim.Rows[0]["PCurrencyID"]));
                    if (ddlConversionCurrency.SelectedIndex.Equals(0))
                    {
                        ucMessage.OpenMessage("Please assign currency in Policy Setup for Interest Claim.", Constants.MSG_TYPE_INFO);
                        ScriptManager.RegisterStartupScript(this.UpdatePanel2, typeof(string), Constants.POPUP_WINDOW, Util.OpenPopup("info"), true);
                    }

                    txtConversionRate.Text    = Convert.ToString(dtIntClaim.Rows[0]["PConvRate"]);
                    txtConversionRate.Enabled = false;

                    if (!string.IsNullOrEmpty(sInterestClaimTransNo))
                    {
                        foreach (GridViewRow gvr in gvData.Rows)
                        {
                            CheckBox chk = (CheckBox)gvr.FindControl("chkSelected");
                            if (chk != null)
                            {
                                chk.Checked = true;
                                chk.Enabled = false;
                            }
                        }
                        txtSelectCount.Text = "TOTAL SELECTED " + dtIntClaim.Rows.Count + " OF " + dtIntClaim.Rows.Count;
                    }
                    else
                    {
                        txtSelectCount.Text = "TOTAL SELECTED 0 OF " + dtIntClaim.Rows.Count;
                    }
                }
            }
        }