/// <summary>
        /// Added By : Himanshu Pandya
        /// Date : 30-12-2012
        /// Desc : Fill Customer Details from Cearch Search Popup
        /// </summary>
        public void BindCustomerDetails()
        {
            try
            {
                if (!string.IsNullOrEmpty(hdnCustomerId.Value))
                {
                    objCustomer = new clsCustomer();
                    dtCustomer = new DataTable();
                    objCustomer.CustomerId = Convert.ToInt64(hdnCustomerId.Value);
                    dtCustomer = objCustomer.SearcheAllCustomerWSearchFilters();
                    if (dtCustomer.Rows.Count > 0)
                    {
                        //Fill Customer Details
                        txtFDCustomerNo.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["CustomerCode"].ToString()) ? dtCustomer.Rows[0]["CustomerCode"].ToString() : string.Empty;
                        ddlCustomerType.SelectedIndex = ddlCustomerType.Items.IndexOf(ddlCustomerType.Items.FindByText(dtCustomer.Rows[0]["CustomerTypeName"].ToString()));
                        ddlFDCustomernamePrefix.SelectedIndex = ddlFDCustomernamePrefix.Items.IndexOf(ddlFDCustomernamePrefix.Items.FindByText(dtCustomer.Rows[0]["NamePrifix"].ToString()));
                        txtFDCusotmerFirstname.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["FirstName"].ToString()) ? dtCustomer.Rows[0]["FirstName"].ToString() : string.Empty;
                        txtFDCustomerMiddlename.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["MiddleName"].ToString()) ? dtCustomer.Rows[0]["MiddleName"].ToString() : string.Empty;
                        txtFDCustomerLastname.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["LastName"].ToString()) ? dtCustomer.Rows[0]["LastName"].ToString() : string.Empty;

                        BindFixDepositeTypes();
                    }
                }
            }
            catch
            { }
            finally
            {
                objCustomer = new clsCustomer();
                dtCustomer = new DataTable();
            }
        }
        /// <summary>
        /// Added By : Himanshu Pandya  
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void gvCustomer_RowEditing(object sender, GridViewEditEventArgs e)
        {
            ObjCustomer = new clsCustomer();
            dtCustomer = new DataTable();
            int iCustomerId;
            try
            {
                iCustomerId = Convert.ToInt32(((Label)gvCustomer.Rows[e.NewEditIndex].FindControl("lblCustomerId")).Text);
                if (iCustomerId > 0)
                {
                    ObjCustomer.CustomerCode = string.Empty;
                    ObjCustomer.FirstName = string.Empty;
                    ObjCustomer.DistrictName = string.Empty;
                    ObjCustomer.CustomerId = iCustomerId;
                    dtCustomer = ObjCustomer.SearcheAllCustomerWSearchFilters();
                    if (dtCustomer.Rows.Count > 0)
                    {
                        //Fill Cusotmer Details
                        hdnCusotmerId.Value = dtCustomer.Rows[0]["CustomerId"].ToString();
                        //ddlCustomerCodePrefix.SelectedIndex = ddlCustomerCodePrefix.Items.IndexOf(ddlCustomerCodePrefix.Items.FindByValue(dtCustomer.Rows[0]["CustomerCode"].ToString().Substring(0, 3)));
                        //txtCustomerNo.Text = dtCustomer.Rows[0]["CustomerCode"].ToString().Substring(4, (Convert.ToInt32(dtCustomer.Rows[0]["CustomerCode"].ToString().Length) - 4));
                        txtCustomerNo.Text = dtCustomer.Rows[0]["CustomerCode"].ToString();
                        ddlCustomerType.SelectedIndex = ddlCustomerType.Items.IndexOf(ddlCustomerType.Items.FindByValue(dtCustomer.Rows[0]["CustomerTypeId"].ToString().Trim()));

                        if (ddlCustomerType.SelectedValue.ToString().Equals(clsEnum.CustomerType.Sadharan.GetHashCode().ToString()))
                        {
                            ShowHideCustomerTypeFields(true);
                        }
                        else if (ddlCustomerType.SelectedValue.ToString().Equals(clsEnum.CustomerType.NaamMatra.GetHashCode().ToString()))
                        {
                            ShowHideCustomerTypeFields(false);
                        }
                        else
                        {
                            ShowHideCustomerTypeFields(true);
                        }

                        ddlCustomernamePrefix.SelectedIndex = ddlCustomernamePrefix.Items.IndexOf(ddlCustomernamePrefix.Items.FindByValue(dtCustomer.Rows[0]["NamePrifix"].ToString().Trim()));
                        ddlBankBranches.SelectedIndex = ddlBankBranches.Items.IndexOf(ddlBankBranches.Items.FindByValue(dtCustomer.Rows[0]["BankBranchId"].ToString().Trim()));
                        txtCusotmerFirstname.Text = dtCustomer.Rows[0]["FirstName"].ToString().Trim();
                        txtCustomerMiddlename.Text = dtCustomer.Rows[0]["MiddleName"].ToString().Trim();
                        txtCustomerLastname.Text = dtCustomer.Rows[0]["LastName"].ToString().Trim();
                        txtCusotomerAddress.Text = dtCustomer.Rows[0]["Address1"].ToString().Trim();
                        ddlCustomerVillage.Text = dtCustomer.Rows[0]["VillageId"].ToString().Trim();

                        //ddlCustomerVillage.SelectedIndex = ddlCustomerVillage.Items.IndexOf(ddlCustomerVillage.Items.FindByValue(dtCustomer.Rows[0]["VillageId"].ToString().Trim()));
                        ddlCustomerTaluka.SelectedIndex = ddlCustomerTaluka.Items.IndexOf(ddlCustomerTaluka.Items.FindByValue(dtCustomer.Rows[0]["TahsilId"].ToString().Trim()));
                        ddlCustomerDistrict.SelectedIndex = ddlCustomerDistrict.Items.IndexOf(ddlCustomerDistrict.Items.FindByValue(dtCustomer.Rows[0]["DistrictId"].ToString().Trim()));
                        txtCustomerPinCode.Text = dtCustomer.Rows[0]["Pincode"].ToString().Trim();
                        txtCustomerPhoneNumber.Text = dtCustomer.Rows[0]["PhoneNumber"].ToString().Trim();
                        txtCustomerDOB.Text = dtCustomer.Rows[0]["DateOfBirth"].ToString();
                        txtCustomerEmail.Text = dtCustomer.Rows[0]["Email"].ToString();
                        txtCustomerSchoolname.Text = dtCustomer.Rows[0]["SchoolName"].ToString();
                        ddlCustomerSchoolTaluka.SelectedIndex = ddlCustomerSchoolTaluka.Items.IndexOf(ddlCustomerSchoolTaluka.Items.FindByValue(dtCustomer.Rows[0]["SchoolTahsilId"].ToString()));
                        ddlCusotmerSchoolDistrict.SelectedIndex = ddlCusotmerSchoolDistrict.Items.IndexOf(ddlCusotmerSchoolDistrict.Items.FindByValue(dtCustomer.Rows[0]["SchoolDistrictId"].ToString()));
                        txtCustomerSchoolPinCode.Text = dtCustomer.Rows[0]["SchoolPinCode"].ToString().Trim();
                        txtCustomerPanCard.Text = dtCustomer.Rows[0]["CustomerPanCard"].ToString().Trim();
                        //txtCustTotalYearOfService.Text = dtCustomer.Rows[0]["TotalYearOfService"].ToString().Trim();
                        txtCustEmploymentYear.Text = dtCustomer.Rows[0]["EmploymentYear"].ToString().Trim();
                        //txtCustomerYear.Text = dtCustomer.Rows[0]["CustomerYear"].ToString().Trim();
                        if (!string.IsNullOrEmpty(dtCustomer.Rows[0]["Salary"].ToString()))
                        {
                            txtCustomerSalary.Text = CommonFunctions.FormatMoneyString(Convert.ToDecimal(dtCustomer.Rows[0]["Salary"]));
                        }
                        txtCustRetirementDate.Text = dtCustomer.Rows[0]["RetirementYear"].ToString().Trim();

                        //Fill Nominee Details
                        hdnNomineeId.Value = dtCustomer.Rows[0]["NomineeId"].ToString().Trim();
                        ddlCustNomineePrefix.SelectedIndex = ddlCustNomineePrefix.Items.IndexOf(ddlCustNomineePrefix.Items.FindByValue(dtCustomer.Rows[0]["NomineeNamePrefix"].ToString().Trim()));
                        txtCustnomineeFirstname.Text = dtCustomer.Rows[0]["NomineeFirstName"].ToString().Trim();
                        txtCustnomineeMiddlename.Text = dtCustomer.Rows[0]["NomineeMiddleName"].ToString().Trim();
                        txtCustnomineeLastname.Text = dtCustomer.Rows[0]["NomineeLastName"].ToString().Trim();
                        txtCustNomineeAddress.Text = dtCustomer.Rows[0]["NomineeAddress"].ToString().Trim();
                        ddlCustNomineeVillage.Text =dtCustomer.Rows[0]["NomineeVillageId"].ToString().Trim();
                        ddlCustNomineeTaluka.SelectedIndex = ddlCustNomineeTaluka.Items.IndexOf(ddlCustNomineeTaluka.Items.FindByValue(dtCustomer.Rows[0]["NomineeTahsilId"].ToString().Trim()));
                        ddlCustNomineeDistrict.SelectedIndex = ddlCustNomineeDistrict.Items.IndexOf(ddlCustNomineeDistrict.Items.FindByValue(dtCustomer.Rows[0]["NomineeDistrictId"].ToString().Trim()));
                        txtCustNomineePinCode.Text = dtCustomer.Rows[0]["NomineePinCode"].ToString().Trim();
                        txtCustNomineePhonenumber.Text = dtCustomer.Rows[0]["NomineePhoneNumber"].ToString().Trim();
                        txtCustNomineeOccupation.Text = dtCustomer.Rows[0]["NomineeOccupation"].ToString().Trim();
                        txtCustRelationWithNominee.Text = dtCustomer.Rows[0]["NomineeRelationWith"].ToString().Trim();

                        hdnAccountId.Value = dtCustomer.Rows[0]["AccountId"].ToString().Trim();
                        txtCustomerAccNumber.Text = dtCustomer.Rows[0]["AccountNumber"].ToString().Trim();
                        txtCustomerAccOpenDate.Text = dtCustomer.Rows[0]["OpeningDate"].ToString().Trim();
                        txtCustomerOpeningBalance.Text = CommonFunctions.FormatMoneyString(Convert.ToDecimal(dtCustomer.Rows[0]["OpeningBalance"]));
                        txtCustomerShareAmt.Text = CommonFunctions.FormatMoneyString(Convert.ToDecimal(dtCustomer.Rows[0]["ShareBalance"]));
                        //ddlCustomerAccType.SelectedIndex = ddlCustomerAccType.Items.IndexOf(ddlCustomerAccType.Items.FindByValue(dtCustomer.Rows[0]["AccountTypeId"].ToString().Trim()));
                        //txtCustomerKayamnidhiBal.Text = CommonFunctions.FormatMoneyString(Convert.ToDecimal(dtCustomer.Rows[0]["KayamNidhiBalance"]));
                        //txtCustomerAccountBal.Text = CommonFunctions.FormatMoneyString(Convert.ToDecimal(dtCustomer.Rows[0]["AccountBalance"]));

                        /*teprary validation false
                         *
                         * txtCustomerAccNumber.Enabled = false;
                        txtCustomerAccOpenDate.Enabled = false;
                        txtCustomerOpeningBalance.Enabled = false;
                        txtCustomerShareAmt.Enabled = false;
                        ddlCustomerType.Enabled = false;
                        */
                        ShowHideCusotmerGrid(false);
                    }
                }
            }
            catch (Exception) { }
            finally { ObjCustomer = null; dtCustomer = null; }

            ShowHideCusotmerGrid(false);
        }
        /// <summary>
        /// Added By : Himanshu Pandya  
        /// </summary>
        private void BindCustomerGrid()
        {
            ObjCustomer = new clsCustomer();
            dtCustomer = new DataTable();
            try
            {
                ShowHideCusotmerGrid(true);

                if (!string.IsNullOrEmpty(txtSearchCustomer.Text) && !string.IsNullOrEmpty(ddlCustomerSearch.SelectedValue))
                {
                    string strsearch = ddlCustomerSearch.SelectedValue.ToString();
                    switch (strsearch)
                    {
                        case "CustomerNo":
                            ObjCustomer.CustomerCode = txtSearchCustomer.Text.ToString();
                            break;
                        case "CusotmerName":
                            ObjCustomer.FirstName = txtSearchCustomer.Text.ToString();
                            break;
                        case "CusotmerDistrict":
                            ObjCustomer.DistrictName = txtSearchCustomer.Text.ToString();
                            break;
                        default:
                            break;
                    }
                }
                else
                {
                    ObjCustomer.CustomerCode = string.Empty;
                    ObjCustomer.FirstName = string.Empty;
                    ObjCustomer.DistrictName = string.Empty;
                }

                dtCustomer = ObjCustomer.SearcheAllCustomerWSearchFilters();
                if (dtCustomer.Rows.Count > 0)
                {
                    gvCustomer.DataSource = dtCustomer;
                }
                else
                {
                    gvCustomer.DataSource = null;
                }

                gvCustomer.PageSize = Convert.ToInt32(ddlPager.SelectedValue.ToString());
                gvCustomer.DataBind();
            }
            catch { }
            finally { ObjCustomer = null; dtCustomer = null; }
        }
 /// <summary>
 /// Added By : Himanshu Pandya
 /// Date : 30-12-2012
 /// Desc : Fill Customer Details from Cearch Search Popup
 /// </summary>
 public void BindWitnessDetails(Int64 CustomerId, string WitnessId)
 {
     DataTable dtCustomer;
     try
     {
         if ((CustomerId > 1) && (!string.IsNullOrEmpty(WitnessId)))
         {
             ObjCust = new clsCustomer();
             dtCustomer = new DataTable();
             ObjCust.CustomerId = CustomerId;
             dtCustomer = ObjCust.SearcheAllCustomerWSearchFilters();
             if (dtCustomer.Rows.Count > 0)
             {
                 //Fill Customer Details
                 switch (WitnessId)
                 {
                     case "1":
                         hdnWitnessID1.Value = Convert.ToString(CustomerId);
                         txtCustWitnessNo1.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["CustomerCode"].ToString()) ? dtCustomer.Rows[0]["CustomerCode"].ToString() : string.Empty;
                         ddlCustWitnessPrefix1.SelectedIndex = ddlCustWitnessPrefix1.Items.IndexOf(ddlCustWitnessPrefix1.Items.FindByText(dtCustomer.Rows[0]["NamePrifix"].ToString()));
                         txtCustWitnessFirstName1.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["FirstName"].ToString()) ? dtCustomer.Rows[0]["FirstName"].ToString() : string.Empty;
                         txtCustWitnessMiddleName1.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["MiddleName"].ToString()) ? dtCustomer.Rows[0]["MiddleName"].ToString() : string.Empty;
                         txtCustWitnessLastName1.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["LastName"].ToString()) ? dtCustomer.Rows[0]["LastName"].ToString() : string.Empty;
                         txtCustWitnessSchool1.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["SchoolName"].ToString()) ? dtCustomer.Rows[0]["SchoolName"].ToString() : string.Empty;
                         ddlCustWitnessTaluka1.SelectedIndex = ddlCustWitnessTaluka1.Items.IndexOf(ddlCustWitnessTaluka1.Items.FindByValue(dtCustomer.Rows[0]["TahsilId"].ToString()));
                         break;
                     case "2":
                         hdnWitnessID2.Value = Convert.ToString(CustomerId);
                         txtCustWitnessNo2.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["CustomerCode"].ToString()) ? dtCustomer.Rows[0]["CustomerCode"].ToString() : string.Empty;
                         ddlCustWitnessPrefix2.SelectedIndex = ddlCustWitnessPrefix2.Items.IndexOf(ddlCustWitnessPrefix2.Items.FindByText(dtCustomer.Rows[0]["NamePrifix"].ToString()));
                         txtCustWitnessFirstName2.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["FirstName"].ToString()) ? dtCustomer.Rows[0]["FirstName"].ToString() : string.Empty;
                         txtCustWitnessMiddleName2.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["MiddleName"].ToString()) ? dtCustomer.Rows[0]["MiddleName"].ToString() : string.Empty;
                         txtCustWitnessLastName2.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["LastName"].ToString()) ? dtCustomer.Rows[0]["LastName"].ToString() : string.Empty;
                         txtCustWitnessSchool2.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["SchoolName"].ToString()) ? dtCustomer.Rows[0]["SchoolName"].ToString() : string.Empty;
                         ddlCustWitnessTaluka2.SelectedIndex = ddlCustWitnessTaluka2.Items.IndexOf(ddlCustWitnessTaluka2.Items.FindByValue(dtCustomer.Rows[0]["TahsilId"].ToString()));
                         break;
                     case "3":
                         hdnWitnessID3.Value = Convert.ToString(CustomerId);
                         txtCustWitnessNo3.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["CustomerCode"].ToString()) ? dtCustomer.Rows[0]["CustomerCode"].ToString() : string.Empty;
                         ddlCustWitnessPrefix3.SelectedIndex = ddlCustWitnessPrefix3.Items.IndexOf(ddlCustWitnessPrefix3.Items.FindByText(dtCustomer.Rows[0]["NamePrifix"].ToString()));
                         txtCustWitnessFirstName3.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["FirstName"].ToString()) ? dtCustomer.Rows[0]["FirstName"].ToString() : string.Empty;
                         txtCustWitnessMiddleName3.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["MiddleName"].ToString()) ? dtCustomer.Rows[0]["MiddleName"].ToString() : string.Empty;
                         txtCustWitnessLastName3.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["LastName"].ToString()) ? dtCustomer.Rows[0]["LastName"].ToString() : string.Empty;
                         txtCustWitnessSchool3.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["SchoolName"].ToString()) ? dtCustomer.Rows[0]["SchoolName"].ToString() : string.Empty;
                         ddlCustWitnessTaluka3.SelectedIndex = ddlCustWitnessTaluka3.Items.IndexOf(ddlCustWitnessTaluka3.Items.FindByValue(dtCustomer.Rows[0]["TahsilId"].ToString()));
                         break;
                     case "4":
                         hdnWitnessID4.Value = Convert.ToString(CustomerId);
                         txtCustWitnessNo4.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["CustomerCode"].ToString()) ? dtCustomer.Rows[0]["CustomerCode"].ToString() : string.Empty;
                         ddlCustWitnessPrefix4.SelectedIndex = ddlCustWitnessPrefix4.Items.IndexOf(ddlCustWitnessPrefix4.Items.FindByText(dtCustomer.Rows[0]["NamePrifix"].ToString()));
                         txtCustWitnessFirstName4.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["FirstName"].ToString()) ? dtCustomer.Rows[0]["FirstName"].ToString() : string.Empty;
                         txtCustWitnessMiddleName4.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["MiddleName"].ToString()) ? dtCustomer.Rows[0]["MiddleName"].ToString() : string.Empty;
                         txtCustWitnessLastName4.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["LastName"].ToString()) ? dtCustomer.Rows[0]["LastName"].ToString() : string.Empty;
                         txtCustWitnessSchool4.Text = !string.IsNullOrEmpty(dtCustomer.Rows[0]["SchoolName"].ToString()) ? dtCustomer.Rows[0]["SchoolName"].ToString() : string.Empty;
                         ddlCustWitnessTaluka4.SelectedIndex = ddlCustWitnessTaluka4.Items.IndexOf(ddlCustWitnessTaluka4.Items.FindByValue(dtCustomer.Rows[0]["TahsilId"].ToString()));
                         break;
                 }
                 hdnBindLoanData.Value = string.Empty;
             }
         }
     }
     catch { }
     finally
     {
         ObjCust = new clsCustomer();
         dtCustomer = new DataTable();
     }
 }