コード例 #1
0
        /// <summary>
        /// 
        /// </summary>
        private void BindLoanGrid()
        {
            ObjLoan = new clsLoan();
            dtLoan = new DataTable();
            try
            {
                if (!string.IsNullOrEmpty(txtSearchCustomer.Text) && !string.IsNullOrEmpty(ddlLoanSearch.SelectedValue))
                {
                    string strsearch = ddlLoanSearch.SelectedValue.ToString();
                    switch (strsearch)
                    {
                        case "CustomerNo":
                            ObjLoan.CustomerCode = txtSearchCustomer.Text.ToString();
                            break;
                        case "CusotmerName":
                            ObjLoan.CoustmerName = txtSearchCustomer.Text.ToString();
                            break;
                        case "CusotmerDistrict":
                            ObjLoan.DistrictName = txtSearchCustomer.Text.ToString();
                            break;
                        default:
                            break;
                    }
                }
                else
                {
                    ObjLoan.CustomerCode = string.Empty;
                    ObjLoan.CoustmerName = string.Empty;
                    ObjLoan.DistrictName = string.Empty;
                }

                dtLoan = ObjLoan.LoanWithSearchFilters();
                if (dtLoan.Rows.Count > 0)
                {
                    gvCustomerLoan.DataSource = dtLoan;
                }
                else
                {
                    gvCustomerLoan.DataSource = null;
                }

                gvCustomerLoan.PageSize = Convert.ToInt32(ddlPager.SelectedValue.ToString());
                gvCustomerLoan.DataBind();
            }
            catch { }
            finally { ObjLoan = null; ObjLoan = null; }
        }
コード例 #2
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void gvCustomerLoan_RowEditing(object sender, GridViewEditEventArgs e)
        {
            ObjLoan = new clsLoan();
            dtLoan = new DataTable();
            clsComFun = new CommonFunctions();
            int iLoanId;
            string strValue = string.Empty;
            int intMonth = 0, intYear = 0;
            try
            {
                //BindLoanTypes();
                iLoanId = Convert.ToInt32(((Label)gvCustomerLoan.Rows[e.NewEditIndex].FindControl("lblLoanId")).Text);
                if (iLoanId > 0)
                {
                    ObjLoan.LoanId = iLoanId;
                    dtLoan = ObjLoan.LoanWithSearchFilters();
                    if (dtLoan.Rows.Count > 0)
                    {
                        //Fill Loan Details
                        hdnCustomerId.Value = dtLoan.Rows[0]["CustomerId"].ToString();
                        hdnLoanId.Value = dtLoan.Rows[0]["LoanID"].ToString();

                        //Loan Details
                        txtLoanDate.Text = dtLoan.Rows[0]["LoanDate"].ToString();
                        ddlLoanType.SelectedValue = dtLoan.Rows[0]["LoanTypeID"].ToString();
                        txtLoanAmt.Text = CommonFunctions.FormatMoneyString(Convert.ToDecimal(dtLoan.Rows[0]["LoanAmount"]));
                        txtEmiAmt.Text = CommonFunctions.FormatMoneyString(Convert.ToDecimal(dtLoan.Rows[0]["InstallmentAmount"]));

                        strValue = dtLoan.Rows[0]["LoanPeriod"].ToString();
                        intYear = (System.Convert.ToInt32(strValue) / 12);
                        ddlLoanYear.SelectedValue = intYear.ToString();
                        intMonth = (System.Convert.ToInt32(strValue) - (intYear * 12));
                        ddlLoanMonth.SelectedValue = intMonth.ToString();

                        ddlCustomerPastLoanEMI.SelectedValue = dtLoan.Rows[0]["LoanPaidTypeID"].ToString();
                        txtCustomerLoanPurpose.Text = dtLoan.Rows[0]["LoanReason"].ToString();
                        txtTotalLoanInstallmentAmt.Text = CommonFunctions.FormatMoneyString(Convert.ToDecimal(dtLoan.Rows[0]["TotalInstallment"]));

                        BindCustomerDetails(Convert.ToInt64(dtLoan.Rows[0]["CustomerId"].ToString()));
                        BindWitnessDetails(Convert.ToInt64(dtLoan.Rows[0]["WitnessID1"]), "1");
                        BindWitnessDetails(Convert.ToInt64(dtLoan.Rows[0]["WitnessID2"]), "2");
                        BindWitnessDetails(Convert.ToInt64(dtLoan.Rows[0]["WitnessID3"]), "3");
                        BindWitnessDetails(Convert.ToInt64(dtLoan.Rows[0]["WitnessID4"]), "4");

                        EnableDisabledControls(false);
                        ShowHideLoanGrid(false);
                        ShowHideLoanWitnessFields(false);
                    }
                }
            }
            catch (Exception) { }
            finally
            {
                ObjLoan = null;
                ObjCust = null;
                dtLoan = null;
            }
            ShowHideLoanGrid(false);
            EnableDisabledControls(false);
        }