Exemple #1
0
    protected void tferorRegNoTextBox_TextChanged(object sender, EventArgs e)
    {
        UnitHolderRegistration unitRegObj = new UnitHolderRegistration();

        unitRegObj.FundCode   = tferorFundCodeTextBox.Text.Trim();
        unitRegObj.BranchCode = tferorBranchCodeTextBox.Text.Trim();
        unitRegObj.RegNumber  = tferorRegNoTextBox.Text.Trim();


        DataTable dtRegInfo            = opendMFDAO.getDtRegInfo(unitRegObj);
        DataTable dtTotalSaleUnitCerts = opendMFDAO.getDtTotalSaleUnitCerts(unitRegObj);
        decimal   TotalUnitsBalance    = opendMFDAO.getTotalSaleUnitBalance(unitRegObj);

        if (dtRegInfo.Rows.Count > 0)
        {
            tferorHolderNameTextBox.Text  = dtRegInfo.Rows[0]["HNAME"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["HNAME"].ToString();
            tferorjHolderNameTextBox.Text = dtRegInfo.Rows[0]["JNT_NAME"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["JNT_NAME"].ToString();

            string[] branchCodeSign    = unitRegObj.BranchCode.Split('/');
            string   imageSignLocation = Path.Combine(ConfigReader.SingLocation + "\\" + unitRegObj.FundCode, unitRegObj.FundCode + "_" + branchCodeSign[0] + "_" + branchCodeSign[1] + "_" + unitRegObj.RegNumber + ".jpg");

            if (File.Exists(Path.Combine(ConfigReader.SingLocation + "\\" + unitRegObj.FundCode, unitRegObj.FundCode.ToString() + "_" + branchCodeSign[0] + "_" + branchCodeSign[1] + "_" + unitRegObj.RegNumber + ".jpg")))
            {
                SignImage.ImageUrl = encrypt.PhotoBase64ImgSrc(imageSignLocation.ToString());
            }
            else
            {
                SignImage.ImageUrl = encrypt.PhotoBase64ImgSrc(Path.Combine(ConfigReader.SingLocation, "Notavailable.JPG").ToString());
            }
            if (dtTotalSaleUnitCerts.Rows.Count > 0)
            {
                TotalLienUnitHoldingTextBox.Text = unitLienBLObj.totalLienAmount(unitRegObj).ToString();
                dvContentBottom.Visible          = true;
                leftDataGrid.DataSource          = dtTotalSaleUnitCerts;
                leftDataGrid.DataBind();
                transferNoTextBox.Text       = unitTransferBLObj.getNextTransferNo(unitRegObj, userObj).ToString();
                TotalUnitHoldingTextBox.Text = TotalUnitsBalance.ToString();
            }
            else
            {
                TotalUnitHoldingTextBox.Text     = "";
                TotalUnitRepurchaseTextBox.Text  = "";
                TotalLienUnitHoldingTextBox.Text = unitLienBLObj.totalLienAmount(unitRegObj).ToString();
                dvContentBottom.Visible          = false;
                transferNoTextBox.Text           = unitTransferBLObj.getNextTransferNo(unitRegObj, userObj).ToString();
                TotalUnitHoldingTextBox.Text     = TotalUnitsBalance.ToString();
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('No Units To Transfer');", true);
            }
        }
        else
        {
            TotalUnitHoldingTextBox.Text     = "";
            TotalUnitRepurchaseTextBox.Text  = "";
            TotalLienUnitHoldingTextBox.Text = "";
            tferorHolderNameTextBox.Text     = "";
            tferorjHolderNameTextBox.Text    = "";
            dvContentBottom.Visible          = false;
            ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('Invalid Registration Number');", true);
        }
    }
    protected void findButton_Click(object sender, EventArgs e)
    {
        UnitHolderRegistration unitRegObj = new UnitHolderRegistration();

        unitRegObj.FundCode   = FundCodeTextBox.Text.Trim();
        unitRegObj.BranchCode = BranchCodeTextBox.Text.Trim();
        unitRegObj.RegNumber  = RegNoTextBox.Text.Trim();
        UnitLien  unitLienObj = new UnitLien();
        DataTable dtRegInfo   = opendMFDAO.getDtRegInfo(unitRegObj);

        if (dtRegInfo.Rows.Count > 0)
        {
            HolderNameTextBox.Text  = dtRegInfo.Rows[0]["HNAME"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["HNAME"].ToString();
            HolderJNameTextBox.Text = dtRegInfo.Rows[0]["JNT_NAME"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["JNT_NAME"].ToString();
            DataTable dtLienNumbers = unitLienBLObj.dtTotalLien(unitRegObj);
            if (dtLienNumbers.Rows.Count > 1)
            {
                LienMarkDropDownList.DataSource     = dtLienNumbers;
                LienMarkDropDownList.DataTextField  = "LIEN_NO";
                LienMarkDropDownList.DataValueField = "ID";
                LienMarkDropDownList.DataBind();
            }
            else
            {
                LienMarkDropDownList.DataSource     = dtLienNumbers;
                LienMarkDropDownList.DataTextField  = "LIEN_NO";
                LienMarkDropDownList.DataValueField = "ID";
                LienMarkDropDownList.DataBind();
                ClearText();
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('No Liened Units');", true);
            }
        }
    }
    public void displayRegInfo()
    {
        UnitSale saleObj = new UnitSale();
        UnitHolderRegistration unitRegObj = new UnitHolderRegistration();

        unitRegObj.FundCode   = fundCodeTextBox.Text.Trim();
        unitRegObj.BranchCode = branchCodeTextBox.Text.Trim();
        unitRegObj.RegNumber  = regNoTextBox.Text.Trim();

        if (opendMFDAO.IsValidRegistration(unitRegObj))
        {
            DataTable dtRegInfo = opendMFDAO.getDtRegInfo(unitRegObj);
            if (dtRegInfo.Rows.Count > 0)
            {
                holderNameTextBox.Text     = dtRegInfo.Rows[0]["HNAME"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["HNAME"].ToString();
                jHolderTextBox.Text        = dtRegInfo.Rows[0]["JNT_NAME"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["JNT_NAME"].ToString();
                holderAddress1TextBox.Text = dtRegInfo.Rows[0]["ADDRS1"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["ADDRS1"].ToString();
                holderAddress2TextBox.Text = dtRegInfo.Rows[0]["ADDRS2"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["ADDRS2"].ToString();
                holderTelphoneTextBox.Text = dtRegInfo.Rows[0]["TEL_NO"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["TEL_NO"].ToString();
                string CIP = dtRegInfo.Rows[0]["CIP"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["CIP"].ToString();
                if (string.Compare(CIP, "Y", true) == 0)
                {
                    tdCIP.InnerHtml = " YES ";
                }
                else if (string.Compare(CIP, "N", true) == 0)
                {
                    tdCIP.InnerHtml = " NO ";
                }

                displaySign();
                dinoGridView.DataSource = opendMFDAO.getTableDinomination();
                dinoGridView.DataBind();
                dinoGridView.Visible = false;

                saleNumberTextBox.Text = unitSaleBLObj.getNextSaleNo(unitRegObj, userObj).ToString();
                // MoneyReceiptNoTextBox.Text = unitSaleBLObj.getNextMoneReceiptNo(unitRegObj, userObj).ToString();
                saleObj.SaleNo       = unitSaleBLObj.getNextSaleNo(unitRegObj, userObj) - 1;
                saleDateTextBox.Text = opendMFDAO.getLastSaleDate(unitRegObj, saleObj).ToString("dd-MMM-yyyy");
                saleRateTextBox.Text = opendMFDAO.getLastSaleRate(unitRegObj, saleObj).ToString();
                saleTypeDropDownList.SelectedValue = unitSaleBLObj.GetNextSaleType(unitRegObj, userObj).ToString();
            }
            else
            {
                SignImage.ImageUrl = encrypt.PhotoBase64ImgSrc(Path.Combine(ConfigReader.SingLocation, "Notavailable.JPG").ToString());
                //  PhotoImage.ImageUrl = Path.Combine(ConfigReader.PhotoLocation, "Notavailable.JPG").ToString();
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", " window.fnResetAll();", true);
                tdCIP.InnerHtml      = "";
                dinoGridView.Visible = false;
            }
        }
        else
        {
            SignImage.ImageUrl   = encrypt.PhotoBase64ImgSrc(Path.Combine(ConfigReader.SingLocation, "Notavailable.JPG").ToString());
            tdCIP.InnerHtml      = "";
            dinoGridView.Visible = false;
            ClearText();
            ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('Invalid Registration Number');", true);
        }
    }
    public void displayRegInfo()
    {
        UnitSale saleObj = new UnitSale();
        UnitHolderRegistration unitRegObj = new UnitHolderRegistration();

        unitRegObj.FundCode   = fundCodeTextBox.Text.Trim();
        unitRegObj.BranchCode = branchCodeTextBox.Text.Trim();
        unitRegObj.RegNumber  = regNoTextBox.Text.Trim();

        if (opendMFDAO.IsValidRegistration(unitRegObj))
        {
            moneyReceipDropDownList.DataSource     = unitSaleBLObj.dtMoneyRecieptInfoforDDL(unitRegObj, "SL");
            moneyReceipDropDownList.DataTextField  = "RECEIPT_NO";
            moneyReceipDropDownList.DataValueField = "ID";
            moneyReceipDropDownList.DataBind();
            DataTable dtRegInfo = opendMFDAO.getDtRegInfo(unitRegObj);
            if (dtRegInfo.Rows.Count > 0)
            {
                holderNameTextBox.Text     = dtRegInfo.Rows[0]["HNAME"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["HNAME"].ToString();
                jHolderTextBox.Text        = dtRegInfo.Rows[0]["JNT_NAME"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["JNT_NAME"].ToString();
                holderAddress1TextBox.Text = dtRegInfo.Rows[0]["ADDRS1"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["ADDRS1"].ToString();
                holderAddress2TextBox.Text = dtRegInfo.Rows[0]["ADDRS2"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["ADDRS2"].ToString();
                holderTelphoneTextBox.Text = dtRegInfo.Rows[0]["TEL_NO"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["TEL_NO"].ToString();
                string CIP = dtRegInfo.Rows[0]["CIP"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["CIP"].ToString();
                if (string.Compare(CIP, "Y", true) == 0)
                {
                    tdCIP.InnerHtml = " YES ";
                }
                else if (string.Compare(CIP, "N", true) == 0)
                {
                    tdCIP.InnerHtml = " NO ";
                }

                displaySign();


                saleNumberTextBox.Text = unitSaleBLObj.getNextSaleNo(unitRegObj, userObj).ToString();

                saleObj.SaleNo = unitSaleBLObj.getNextSaleNo(unitRegObj, userObj) - 1;
            }
            else
            {
                SignImage.ImageUrl = encrypt.PhotoBase64ImgSrc(Path.Combine(ConfigReader.SingLocation, "Notavailable.JPG").ToString());
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", " window.fnResetAll();", true);
                tdCIP.InnerHtml = "";
            }
        }
        else
        {
            SignImage.ImageUrl = encrypt.PhotoBase64ImgSrc(Path.Combine(ConfigReader.SingLocation, "Notavailable.JPG").ToString());
            tdCIP.InnerHtml    = "";

            ClearText();
            ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('Invalid Registration Number');", true);
        }
    }
Exemple #5
0
    protected void findButton_Click(object sender, EventArgs e)
    {
        UnitHolderRegistration regObj = new UnitHolderRegistration();

        regObj.FundCode   = fundCodeDDL.SelectedValue.ToString();
        regObj.BranchCode = branchCodeDDL.SelectedValue.ToString();
        regObj.RegNumber  = regNoTextBox.Text.Trim();
        regObj.BO         = holderBOTextBox.Text.ToString().Trim();

        DataTable dtValidSearch = opendMFDAO.dtValidSearch(regObj);

        if (dtValidSearch.Rows.Count > 0)
        {
            regObj            = new UnitHolderRegistration();
            regObj.FundCode   = fundCodeDDL.SelectedValue.ToString();
            regObj.BranchCode = branchCodeDDL.SelectedValue.ToString();
            regObj.RegNumber  = dtValidSearch.Rows[0]["REG_NO"].ToString();
            DataTable dtRegInfo = opendMFDAO.getDtRegInfo(regObj);

            regNoTextBox.Text    = dtRegInfo.Rows[0]["REG_NO"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["REG_NO"].ToString();
            holderBOTextBox.Text = dtRegInfo.Rows[0]["BO"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["BO"].ToString();
            NameTextBox.Text     = dtRegInfo.Rows[0]["HNAME"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["HNAME"].ToString();
            string string1 = dtRegInfo.Rows[0]["ADDRS1"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["ADDRS1"].ToString();
            string string2 = dtRegInfo.Rows[0]["ADDRS2"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["ADDRS2"].ToString();
            string string3 = dtRegInfo.Rows[0]["CITY"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["CITY"].ToString();
            addressTextBox.Text = string1.ToString() + " " + string2 + " " + string3;
        }
        else
        {
            regNoTextBox.Text    = "";
            holderBOTextBox.Text = "";
            NameTextBox.Text     = "";
            addressTextBox.Text  = "";
            ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('Invalid Registration Number OR BO ');", true);
        }
    }
Exemple #6
0
    protected void RegNoTextBox_TextChanged(object sender, EventArgs e)
    {
        UnitHolderRegistration unitRegObj = new UnitHolderRegistration();

        unitRegObj.FundCode   = FundCodeTextBox.Text.Trim();
        unitRegObj.BranchCode = BranchCodeTextBox.Text.Trim();
        unitRegObj.RegNumber  = RegNoTextBox.Text.Trim();
        UnitRepurchase unitRepObj = new UnitRepurchase();

        if (opendMFDAO.IsValidRegistration(unitRegObj))
        {
            DataTable dtRegInfo            = opendMFDAO.getDtRegInfo(unitRegObj);
            DataTable dtTotalSaleUnitCerts = opendMFDAO.getDtTotalSaleUnitCerts(unitRegObj);
            decimal   TotalUnitsBalance    = opendMFDAO.getTotalSaleUnitBalance(unitRegObj);
            if (dtRegInfo.Rows.Count > 0)
            {
                HolderNameTextBox.Text = dtRegInfo.Rows[0]["HNAME"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["HNAME"].ToString();

                HolderJNameTextBox.Text = dtRegInfo.Rows[0]["JNT_NAME"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["JNT_NAME"].ToString();

                string[] BranchCodeSign     = unitRegObj.BranchCode.Split('/');
                string   imageSignLocation  = Path.Combine(ConfigReader.SingLocation + "\\" + unitRegObj.FundCode, unitRegObj.FundCode + "_" + BranchCodeSign[0] + "_" + BranchCodeSign[1] + "_" + unitRegObj.RegNumber + ".jpg");//"../../Image/IAMCL/Sign/"+ fundCode + "_" + branchCode + "_" + regNo + ".jpg";
                string   imagePhotoLocation = Path.Combine(ConfigReader.PhotoLocation + "\\" + unitRegObj.FundCode, unitRegObj.FundCode + "_" + "_" + BranchCodeSign[0] + BranchCodeSign[1] + "_" + unitRegObj.RegNumber + ".jpg");

                if (File.Exists(Path.Combine(ConfigReader.SingLocation + "\\" + unitRegObj.FundCode, unitRegObj.FundCode + "_" + BranchCodeSign[0] + "_" + BranchCodeSign[1] + "_" + unitRegObj.RegNumber + ".jpg")))
                {
                    SignImage.ImageUrl = encrypt.PhotoBase64ImgSrc(imageSignLocation.ToString());
                }
                else
                {
                    SignImage.ImageUrl = encrypt.PhotoBase64ImgSrc(Path.Combine(ConfigReader.SingLocation, "Notavailable.JPG").ToString());
                }
                if (dtTotalSaleUnitCerts.Rows.Count > 0)
                {
                    dvContentBottom.Visible = true;
                    leftDataGrid.DataSource = dtTotalSaleUnitCerts;
                    leftDataGrid.DataBind();
                    TotalUnitHoldingTextBox.Text     = TotalUnitsBalance.ToString();
                    TotalLienUnitHoldingTextBox.Text = unitLienBLObj.totalLienAmount(unitRegObj).ToString();
                    TotalUnitRepurchaseTextBox.Text  = "";
                }
                else
                {
                    TotalUnitHoldingTextBox.Text     = "";
                    TotalUnitRepurchaseTextBox.Text  = "";
                    TotalLienUnitHoldingTextBox.Text = unitLienBLObj.totalLienAmount(unitRegObj).ToString();
                    dvContentBottom.Visible          = false;
                    //NormalRadioButton.Checked = true;
                    //DeathRadioButton.Checked = false;
                    ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('No Units To Repurchase');", true);
                }

                RepNoTextBox.Text       = unitRepBLObj.getNextRepurchaseNo(unitRegObj, userObj).ToString();
                unitRepObj.RepurchaseNo = unitRepBLObj.getNextRepurchaseNo(unitRegObj, userObj) - 1;
                RepDateTextBox.Text     = unitRepBLObj.getLastRepDate(unitRegObj, unitRepObj).ToString("dd-MMM-yyyy");
                RepRateTextBox.Text     = unitRepBLObj.getLastRepRate(unitRegObj, unitRepObj).ToString();
            }
            else
            {
                TotalUnitHoldingTextBox.Text     = "";
                TotalUnitRepurchaseTextBox.Text  = "";
                TotalLienUnitHoldingTextBox.Text = "";
                dvContentBottom.Visible          = false;
                //NormalRadioButton.Checked = true;
                //DeathRadioButton.Checked = false;
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('No Units To Repurchase');", true);
            }
        }
        else
        {
            ClearText();
            TotalUnitHoldingTextBox.Text     = "";
            TotalUnitRepurchaseTextBox.Text  = "";
            TotalLienUnitHoldingTextBox.Text = "";
            dvContentBottom.Visible          = false;
            //NormalRadioButton.Checked = true;
            //DeathRadioButton.Checked = false;
            ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('Invalid Registration Number');", true);
        }
    }
Exemple #7
0
    protected void moneyReceipDropDownList_SelectedIndexChanged(object sender, EventArgs e)
    {
        DataTable dtMoneyReceitInfoDetails = unitSaleBLObj.dtMoneyRecieptInfoDetails(Convert.ToInt64(moneyReceipDropDownList.SelectedValue.ToString()));

        if (dtMoneyReceitInfoDetails.Rows.Count > 0)
        {
            regObj.FundCode     = FundCodeTextBox.Text.ToString();
            regObj.BranchCode   = BranchCodeTextBox.Text.ToString();
            regObj.RegNumber    = dtMoneyReceitInfoDetails.Rows[0]["REG_NO"].ToString();
            RegNoTextBox.Text   = dtMoneyReceitInfoDetails.Rows[0]["REG_NO"].ToString();
            QtyTextBox.Text     = dtMoneyReceitInfoDetails.Rows[0]["UNIT_QTY"].ToString();
            RepDateTextBox.Text = Convert.ToDateTime(dtMoneyReceitInfoDetails.Rows[0]["RECEIPT_DATE"].ToString()).ToString("dd-MMM-yyyy");
            RepRateTextBox.Text = dtMoneyReceitInfoDetails.Rows[0]["RATE"].ToString();
            if (!dtMoneyReceitInfoDetails.Rows[0]["REP_PAY_TYPE"].Equals(DBNull.Value))
            {
                payTypeLabel.Text = dtMoneyReceitInfoDetails.Rows[0]["REP_PAY_TYPE"].ToString().ToUpper();
            }
            DataTable dtRegInfo            = opendMFDAO.getDtRegInfo(regObj);
            DataTable dtTotalSaleUnitCerts = opendMFDAO.getDtTotalSaleUnitCerts(regObj);
            decimal   TotalUnitsBalance    = opendMFDAO.getTotalSaleUnitBalance(regObj);

            if (dtRegInfo.Rows.Count > 0)
            {
                HolderNameTextBox.Text  = dtRegInfo.Rows[0]["HNAME"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["HNAME"].ToString();
                HolderJNameTextBox.Text = dtRegInfo.Rows[0]["JNT_NAME"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["JNT_NAME"].ToString();
                string[] BranchCodeSign     = regObj.BranchCode.Split('/');
                string   imageSignLocation  = Path.Combine(ConfigReader.SingLocation + "\\" + regObj.FundCode, regObj.FundCode + "_" + BranchCodeSign[0] + "_" + BranchCodeSign[1] + "_" + regObj.RegNumber + ".jpg");//"../../Image/IAMCL/Sign/"+ fundCode + "_" + branchCode + "_" + regNo + ".jpg";
                string   imagePhotoLocation = Path.Combine(ConfigReader.PhotoLocation + "\\" + regObj.FundCode, regObj.FundCode + "_" + "_" + BranchCodeSign[0] + BranchCodeSign[1] + "_" + regObj.RegNumber + ".jpg");

                if (File.Exists(Path.Combine(ConfigReader.SingLocation + "\\" + regObj.FundCode, regObj.FundCode + "_" + BranchCodeSign[0] + "_" + BranchCodeSign[1] + "_" + regObj.RegNumber + ".jpg")))
                {
                    SignImage.ImageUrl = encrypt.PhotoBase64ImgSrc(imageSignLocation.ToString());
                }
                else
                {
                    SignImage.ImageUrl = encrypt.PhotoBase64ImgSrc(Path.Combine(ConfigReader.SingLocation, "Notavailable.JPG").ToString());
                }
                if (dtTotalSaleUnitCerts.Rows.Count > 0)
                {
                    dvContentBottom.Visible = true;
                    leftDataGrid.DataSource = dtTotalSaleUnitCerts;
                    leftDataGrid.DataBind();
                    TotalUnitHoldingTextBox.Text     = TotalUnitsBalance.ToString();
                    TotalLienUnitHoldingTextBox.Text = unitLienBLObj.totalLienAmount(regObj).ToString();
                }
                else
                {
                    TotalUnitHoldingTextBox.Text     = "";
                    TotalUnitRepurchaseTextBox.Text  = "";
                    TotalLienUnitHoldingTextBox.Text = unitLienBLObj.totalLienAmount(regObj).ToString();
                    dvContentBottom.Visible          = false;
                    ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('No Units To Repurchase');", true);
                }
            }
            else
            {
                ClearText();
                TotalUnitHoldingTextBox.Text     = "";
                TotalUnitRepurchaseTextBox.Text  = "";
                TotalLienUnitHoldingTextBox.Text = "";
                dvContentBottom.Visible          = false;
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('No Units To Repurchase');", true);
            }
        }
        else
        {
            ClearText();
            TotalUnitHoldingTextBox.Text     = "";
            TotalUnitRepurchaseTextBox.Text  = "";
            TotalLienUnitHoldingTextBox.Text = "";
            dvContentBottom.Visible          = false;
            ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('No Data Found');", true);
        }
    }
    protected void RegNoTextBox_TextChanged(object sender, EventArgs e)
    {
        UnitHolderRegistration unitRegObj = new UnitHolderRegistration();

        unitRegObj.FundCode   = FundCodeTextBox.Text.Trim();
        unitRegObj.BranchCode = BranchCodeTextBox.Text.Trim();
        unitRegObj.RegNumber  = RegNoTextBox.Text.Trim();
        UnitLien unitLienObj = new UnitLien();


        if (opendMFDAO.IsValidRegistration(unitRegObj))
        {
            DataTable dtRegInfo = opendMFDAO.getDtRegInfo(unitRegObj);
            // DataTable dtTotalSaleUnitCerts = unitLienBLObj.dtTotalLienCert(unitRegObj);
            //  decimal TotalUnitsBalance = opendMFDAO.getTotalSaleUnitBalance(unitRegObj);
            if (dtRegInfo.Rows.Count > 0)
            {
                HolderNameTextBox.Text  = dtRegInfo.Rows[0]["HNAME"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["HNAME"].ToString();
                HolderJNameTextBox.Text = dtRegInfo.Rows[0]["JNT_NAME"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["JNT_NAME"].ToString();

                string[] BranchCodeSign     = unitRegObj.BranchCode.Split('/');
                string   imageSignLocation  = Path.Combine(ConfigReader.SingLocation + "\\" + unitRegObj.FundCode, unitRegObj.FundCode + "_" + BranchCodeSign[0] + "_" + BranchCodeSign[1] + "_" + unitRegObj.RegNumber + ".jpg");//"../../Image/IAMCL/Sign/"+ fundCode + "_" + branchCode + "_" + regNo + ".jpg";
                string   imagePhotoLocation = Path.Combine(ConfigReader.PhotoLocation + "\\" + unitRegObj.FundCode, unitRegObj.FundCode + "_" + "_" + BranchCodeSign[0] + BranchCodeSign[1] + "_" + unitRegObj.RegNumber + ".jpg");

                if (File.Exists(Path.Combine(ConfigReader.SingLocation + "\\" + unitRegObj.FundCode, unitRegObj.FundCode + "_" + BranchCodeSign[0] + "_" + BranchCodeSign[1] + "_" + unitRegObj.RegNumber + ".jpg")))
                {
                    SignImage.ImageUrl = imageSignLocation.ToString();
                }
                else
                {
                    SignImage.ImageUrl = Path.Combine(ConfigReader.SingLocation, "Notavailable.JPG").ToString();
                }
                DataTable dtLienNumbers = unitLienBLObj.dtTotalLien(unitRegObj);
                if (dtLienNumbers.Rows.Count > 1)
                {
                    LienMarkDropDownList.DataSource     = dtLienNumbers;
                    LienMarkDropDownList.DataTextField  = "LIEN_NO";
                    LienMarkDropDownList.DataValueField = "ID";
                    LienMarkDropDownList.DataBind();
                }
                else
                {
                    LienMarkDropDownList.DataSource     = dtLienNumbers;
                    LienMarkDropDownList.DataTextField  = "LIEN_NO";
                    LienMarkDropDownList.DataValueField = "ID";
                    LienMarkDropDownList.DataBind();
                    dvContentBottom.Visible = false;
                    ClearText();
                    ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('No Units To Lien Cancel');", true);
                }
            }
            else
            {
                dvContentBottom.Visible = false;
                ClearText();
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('No Units To  Lien Cancel');", true);
            }
        }
        else
        {
            dvContentBottom.Visible = false;
            ClearText();

            ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('Invalid Registration Number');", true);
        }
    }
    public void displayRegInfo(UnitHolderRegistration unitRegObj)
    {
        dvLedger.Visible = true;

        unitRegObj.FundCode   = fundCodeDDL.SelectedValue.ToString();
        unitRegObj.BranchCode = branchCodeDDL.SelectedValue.ToString();
        unitRegObj.RegNumber  = regNoTextBox.Text.Trim();
        DataTable dtRegInfo = opendMFDAO.getDtRegInfo(unitRegObj);
        DataTable dtNominee = opendMFDAO.dtNomineeRegInfo(unitRegObj);


        if (dtRegInfo.Rows.Count > 0)
        {
            //Trasaction Lock Status

            if (!(dtRegInfo.Rows[0]["ALL_LOCK"].Equals(DBNull.Value) || (dtRegInfo.Rows[0]["ALL_LOCK"].ToString() == "N")) || !(dtRegInfo.Rows[0]["SL_LOCK"].Equals(DBNull.Value) || (dtRegInfo.Rows[0]["SL_LOCK"].ToString() == "N")) || !(dtRegInfo.Rows[0]["REP_LOCK"].Equals(DBNull.Value) || (dtRegInfo.Rows[0]["REP_LOCK"].ToString() == "N")) || !(dtRegInfo.Rows[0]["TR_LOCK"].Equals(DBNull.Value) || (dtRegInfo.Rows[0]["TR_LOCK"].ToString() == "N")) || !(dtRegInfo.Rows[0]["LIEN_LOCK"].Equals(DBNull.Value) || (dtRegInfo.Rows[0]["LIEN_LOCK"].ToString() == "N")) || !(dtRegInfo.Rows[0]["REN_LOCK"].Equals(DBNull.Value) || (dtRegInfo.Rows[0]["REN_LOCK"].ToString() == "N")) || !(dtRegInfo.Rows[0]["LOCK_REMARKS"].Equals(DBNull.Value)))
            {
                dvLockin.Attributes.Add("style", "visibility:visible");
                if (dtRegInfo.Rows[0]["ALL_LOCK"].ToString() == "Y")
                {
                    SaleLockLabel.Text      = "YES";
                    RepLockLabel.Text       = "YES";
                    TransferLockLabel.Text  = "YES";
                    LienLockLabel.Text      = "YES";
                    RenLockLabel.Text       = "YES";
                    LockRemarksTextBox.Text = dtRegInfo.Rows[0]["LOCK_REMARKS"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["LOCK_REMARKS"].ToString();
                }
                else
                {
                    if (dtRegInfo.Rows[0]["SL_LOCK"].ToString() == "Y")
                    {
                        SaleLockLabel.Text = "YES";
                    }
                    else
                    {
                        SaleLockLabel.Text = "NO";
                    }
                    if (dtRegInfo.Rows[0]["REP_LOCK"].ToString() == "Y")
                    {
                        RepLockLabel.Text = "YES";
                    }
                    else
                    {
                        RepLockLabel.Text = "NO";
                    }
                    if (dtRegInfo.Rows[0]["TR_LOCK"].ToString() == "Y")
                    {
                        TransferLockLabel.Text = "YES";
                    }
                    else
                    {
                        TransferLockLabel.Text = "NO";
                    }
                    if (dtRegInfo.Rows[0]["LIEN_LOCK"].ToString() == "Y")
                    {
                        LienLockLabel.Text = "YES";
                    }
                    else
                    {
                        LienLockLabel.Text = "NO";
                    }

                    if (dtRegInfo.Rows[0]["REN_LOCK"].ToString() == "Y")
                    {
                        RenLockLabel.Text = "YES";
                    }
                    else
                    {
                        RenLockLabel.Text = "NO";
                    }



                    LockRemarksTextBox.Text = dtRegInfo.Rows[0]["LOCK_REMARKS"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["LOCK_REMARKS"].ToString();
                }
            }
            else
            {
                SaleLockLabel.Text     = "NO";
                RepLockLabel.Text      = "NO";
                TransferLockLabel.Text = "NO";
                LienLockLabel.Text     = "NO";
                RenLockLabel.Text      = "NO";
                dvLockin.Attributes.Add("style", "visibility:hidden");
            }
            regNoTextBox.Text          = dtRegInfo.Rows[0]["REG_NO"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["REG_NO"].ToString();
            holderBOTextBox.Text       = dtRegInfo.Rows[0]["BO"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["BO"].ToString();
            folioTextBox.Text          = dtRegInfo.Rows[0]["FOLIO_NO"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["FOLIO_NO"].ToString();
            holderNameTextBox.Text     = dtRegInfo.Rows[0]["HNAME"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["HNAME"].ToString();
            jHolderTextBox.Text        = dtRegInfo.Rows[0]["JNT_NAME"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["JNT_NAME"].ToString();
            holderAddress1TextBox.Text = dtRegInfo.Rows[0]["ADDRS1"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["ADDRS1"].ToString();
            holderAddress2TextBox.Text = dtRegInfo.Rows[0]["ADDRS2"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["ADDRS2"].ToString();
            holderTelphoneTextBox.Text = dtRegInfo.Rows[0]["TEL_NO"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["TEL_NO"].ToString();
            tdTIN.InnerHtml            = dtRegInfo.Rows[0]["TIN"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["TIN"].ToString();
            string CIP   = dtRegInfo.Rows[0]["CIP"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["CIP"].ToString();
            string BEFTN = dtRegInfo.Rows[0]["IS_BEFTN"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["IS_BEFTN"].ToString();
            if (string.Compare(CIP, "Y", true) == 0)
            {
                tdCIP.InnerHtml = "YES";
            }
            else if (string.Compare(CIP, "N", true) == 0)
            {
                tdCIP.InnerHtml = "NO";
            }
            else
            {
                tdCIP.InnerHtml = " ";
            }
            if (string.Compare(BEFTN, "Y", true) == 0)
            {
                tdBEFTN.InnerHtml = "YES";
            }
            else
            {
                tdBEFTN.InnerHtml = "NO";
            }
            if (dtNominee.Rows.Count > 1)
            {
                Nominee1NameTextBox.Text = dtNominee.Rows[0]["NOMI_NAME"].ToString();
                Nominee2NameTextBox.Text = dtNominee.Rows[1]["NOMI_NAME"].ToString();
            }
            else if (dtNominee.Rows.Count > 0)
            {
                Nominee1NameTextBox.Text = dtNominee.Rows[0]["NOMI_NAME"].ToString();
                Nominee2NameTextBox.Text = "";
            }
            else
            {
                Nominee1NameTextBox.Text = "";
                Nominee2NameTextBox.Text = "";
            }
            RemarksTextBox.Text = dtRegInfo.Rows[0]["REMARKS"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["REMARKS"].ToString();
            if (dtRegInfo.Rows[0]["BK_FLAG"].ToString() == "Y")
            {
                string bankInfo = "";
                if (!dtRegInfo.Rows[0]["BK_NM_CD"].Equals(DBNull.Value) && !dtRegInfo.Rows[0]["BK_BR_NM_CD"].Equals(DBNull.Value) && !dtRegInfo.Rows[0]["BK_AC_NO"].Equals(DBNull.Value))
                {
                    bankInfo = "AC:" + dtRegInfo.Rows[0]["BK_AC_NO"].ToString();
                    bankInfo = bankInfo + " , " + reportObj.getBankNameByBankCode(Convert.ToInt32(dtRegInfo.Rows[0]["BK_NM_CD"].ToString())).ToString();
                    bankInfo = bankInfo + " , " + reportObj.getBankBranchNameByCode(Convert.ToInt32(dtRegInfo.Rows[0]["BK_NM_CD"].ToString()), Convert.ToInt32(dtRegInfo.Rows[0]["BK_BR_NM_CD"].ToString())).ToString();

                    DataTable dtBankBracnhInfo = unitHolderRegBLObj.dtGetBankBracnhInfo(Convert.ToInt32(dtRegInfo.Rows[0]["BK_NM_CD"].ToString()), Convert.ToInt32(dtRegInfo.Rows[0]["BK_BR_NM_CD"].ToString()));
                    if (dtBankBracnhInfo.Rows.Count > 0)
                    {
                        bankInfo = bankInfo + " Routing No=[" + dtBankBracnhInfo.Rows[0]["ROUTING_NO"].ToString() + "] " + dtBankBracnhInfo.Rows[0]["ADDRESS"].ToString() + " ";
                    }
                }
                BankInfoTextBox.Text = bankInfo.ToString();
            }
            else
            {
                BankInfoTextBox.Text = "";
            }

            DataTable dtDividendLedger = getDividendLedger(unitRegObj);
            //  int balance = 0;
            if (dtDividendLedger.Rows.Count > 0)
            {
                dgLedger.DataSource = dtDividendLedger;
                dgLedger.DataBind();
                totalRowCountLabel.Text     = dtDividendLedger.Rows.Count.ToString();
                Session["dtDividendLedger"] = dtDividendLedger;
                displaySign();
            }
            else
            {
                ClearText();
                SignImage.ImageUrl          = Path.Combine(ConfigReader.SingLocation, "Notavailable.JPG").ToString();
                dvLedger.Visible            = false;
                Session["dtDividendLedger"] = null;
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('No Ledger Balance Data Found');", true);
            }
        }

        else
        {
            SignImage.ImageUrl          = Path.Combine(ConfigReader.SingLocation, "Notavailable.JPG").ToString();
            dvLedger.Visible            = false;
            Session["dtDividendLedger"] = null;
            ClientScript.RegisterStartupScript(this.GetType(), "Popup", " window.fnResetAll();", true);
            tdCIP.InnerHtml = "";
        }
    }
Exemple #10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string fundCode   = "";
        string branchCode = "";
        string regiNo     = "";

        if (BaseContent.IsSessionExpired())
        {
            Response.Redirect("../../Default.aspx");
            return;
        }
        bcContent = (BaseClass)Session["BCContent"];

        userObj.UserID = bcContent.LoginID.ToString();

        branchCode = (string)Session["branchCode"];
        fundCode   = (string)Session["fundCode"];
        regiNo     = (string)Session["regiNo"];



        DataTable dtLedgerForReport = (DataTable)Session["dtLedgerForReport"];

        dtLedgerForReport.TableName = "dtLedgerForReport";

        if (dtLedgerForReport.Rows.Count > 0)
        {
            UnitHolderRegistration unitRegObj = new UnitHolderRegistration();
            unitRegObj.FundCode   = fundCode.ToString();
            unitRegObj.BranchCode = branchCode.ToString();
            unitRegObj.RegNumber  = regiNo.ToString();
            DataTable dtLedgerRegInfo = opendMFDAO.getDtRegInfo(unitRegObj);
            dtLedgerRegInfo.TableName = "dtLedgerRegInfo";

            string regiNumber      = dtLedgerRegInfo.Rows[0]["REG_BK"].ToString() + "/" + dtLedgerRegInfo.Rows[0]["REG_BR"].ToString() + "/" + dtLedgerRegInfo.Rows[0]["REG_NO"].ToString();
            string holderName      = dtLedgerRegInfo.Rows[0]["HNAME"].Equals(DBNull.Value)? "":dtLedgerRegInfo.Rows[0]["HNAME"].ToString();
            string JointHolderName = dtLedgerRegInfo.Rows[0]["JNT_NAME"].Equals(DBNull.Value)? "":dtLedgerRegInfo.Rows[0]["JNT_NAME"].ToString();
            string address1        = dtLedgerRegInfo.Rows[0]["ADDRS1"].Equals(DBNull.Value)? "":dtLedgerRegInfo.Rows[0]["ADDRS1"].ToString();
            string address2        = dtLedgerRegInfo.Rows[0]["ADDRS2"].Equals(DBNull.Value)? "":dtLedgerRegInfo.Rows[0]["ADDRS2"].ToString();
            string city            = dtLedgerRegInfo.Rows[0]["CITY"].Equals(DBNull.Value)? "":dtLedgerRegInfo.Rows[0]["CITY"].ToString();
            string cip             = dtLedgerRegInfo.Rows[0]["CIP"].Equals(DBNull.Value)? "":dtLedgerRegInfo.Rows[0]["CIP"].Equals("Y") ? "YES":"NO";
            string regType         = dtLedgerRegInfo.Rows[0]["REG_TYPE"].Equals(DBNull.Value) ? "" : reportObj.getRegTypeFullName(dtLedgerRegInfo.Rows[0]["REG_TYPE"].ToString());
            string BO_Folio        = "";
            if (!dtLedgerRegInfo.Rows[0]["BO"].Equals(DBNull.Value))
            {
                BO_Folio = dtLedgerRegInfo.Rows[0]["BO"].ToString();
            }
            else if (!dtLedgerRegInfo.Rows[0]["FOLIO_NO"].Equals(DBNull.Value))
            {
                BO_Folio = dtLedgerRegInfo.Rows[0]["FOLIO_NO"].ToString();
            }
            string BEFTN = "";
            if (!dtLedgerRegInfo.Rows[0]["IS_BEFTN"].Equals(DBNull.Value))
            {
                BEFTN = dtLedgerRegInfo.Rows[0]["IS_BEFTN"].Equals("Y") ? "YES" : "NO";
            }

            string ETIN = dtLedgerRegInfo.Rows[0]["TIN"].Equals(DBNull.Value) ? "" : dtLedgerRegInfo.Rows[0]["TIN"].ToString();



            //dtLedgerForReport. WriteXmlSchema(@"F:\GITHUB_AMCL\DOTNET2015\AMCL.OPENMF\AMCL.REPORT\XMLSCHEMAS\dtLedgerForReport.xsd");

            CR_Ledger.Refresh();
            CR_Ledger.SetDataSource(dtLedgerForReport);

            CR_Ledger.SetParameterValue("fundName", opendMFDAO.GetFundName(fundCode.ToString()));
            CR_Ledger.SetParameterValue("branchName", opendMFDAO.GetBranchName(branchCode.ToString()).ToString());
            CR_Ledger.SetParameterValue("branchCode", branchCode.ToString());
            CR_Ledger.SetParameterValue("Regi_No", regiNumber);
            CR_Ledger.SetParameterValue("Holder_Name", holderName.ToString());
            CR_Ledger.SetParameterValue("Jholder_name", JointHolderName.ToString());
            CR_Ledger.SetParameterValue("Address1", address1.ToString());
            CR_Ledger.SetParameterValue("Address2", address2.ToString());
            CR_Ledger.SetParameterValue("City", city.ToString());
            CR_Ledger.SetParameterValue("Cip", cip.ToString());
            CR_Ledger.SetParameterValue("Reg_Type", regType.ToString());
            CR_Ledger.SetParameterValue("BO_Folio", BO_Folio.ToString());
            CR_Ledger.SetParameterValue("BEFTN", BEFTN.ToString());
            CR_Ledger.SetParameterValue("ETIN", ETIN.ToString());



            CrystalReportViewer1.ReportSource = CR_Ledger;
        }
        else
        {
            Response.Write("No data found");
        }
    }
    public void displayRegInfo()
    {
        UnitHolderRegistration unitRegObj = new UnitHolderRegistration();

        unitRegObj.FundCode   = fundCodeTextBox.Text.Trim();
        unitRegObj.BranchCode = branchCodeTextBox.Text.Trim();
        unitRegObj.RegNumber  = regNoTextBox.Text.Trim();

        if (opendMFDAO.IsValidRegistration(unitRegObj))
        {
            DataTable dtRegInfo            = opendMFDAO.getDtRegInfo(unitRegObj);
            DataTable dtTotalSaleUnitCerts = opendMFDAO.getDtTotalSaleUnitCerts(unitRegObj);
            decimal   TotalUnitsBalance    = opendMFDAO.getTotalSaleUnitBalance(unitRegObj);
            if (dtRegInfo.Rows.Count > 0)
            {
                holderNameTextBox.Text     = dtRegInfo.Rows[0]["HNAME"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["HNAME"].ToString();
                jHolderTextBox.Text        = dtRegInfo.Rows[0]["JNT_NAME"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["JNT_NAME"].ToString();
                holderAddress1TextBox.Text = dtRegInfo.Rows[0]["ADDRS1"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["ADDRS1"].ToString();
                holderAddress2TextBox.Text = dtRegInfo.Rows[0]["ADDRS2"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["ADDRS2"].ToString();
                holderTelphoneTextBox.Text = dtRegInfo.Rows[0]["TEL_NO"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["TEL_NO"].ToString();
                string CIP = dtRegInfo.Rows[0]["CIP"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["CIP"].ToString();
                if (string.Compare(CIP, "Y", true) == 0)
                {
                    tdCIP.InnerHtml = "YES";
                }
                else if (string.Compare(CIP, "N", true) == 0)
                {
                    tdCIP.InnerHtml = "NO";
                }

                displaySign();

                if (dtTotalSaleUnitCerts.Rows.Count > 0)
                {
                    renewalUnitsTextBox.Text = "";
                    leftDataGrid.Visible     = true;
                    dvContentBottom.Visible  = true;
                    dinoGridView.Visible     = false;
                    leftDataGrid.DataSource  = dtTotalSaleUnitCerts;
                    leftDataGrid.DataBind();
                    totalUnitsTextBox.Text = TotalUnitsBalance.ToString();
                }
                else
                {
                    dinoGridView.DataSource = opendMFDAO.getTableDinomination();
                    dinoGridView.DataBind();
                    dinoGridView.Visible     = false;
                    leftDataGrid.Visible     = false;
                    totalUnitsTextBox.Text   = "";
                    renewalUnitsTextBox.Text = "";
                    ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('No Units To Renewal');", true);
                }

                renewalNumberTextBox.Text = renewalBLObj.getNextRenNo(unitRegObj, userObj).ToString();

                // saleObj.SaleNo = unitSaleBLObj.getNextSaleNo(unitRegObj, userObj) - 1;
                // renewalDateTextBox.Text = opendMFDAO.getLastSaleDate(unitRegObj, saleObj).ToString("dd-MMM-yyyy");
                // saleRateTextBox.Text = opendMFDAO.getLastSaleRate(unitRegObj, saleObj).ToString();
                // saleTypeDropDownList.SelectedValue = unitSaleBLObj.GetNextSaleType(unitRegObj, userObj).ToString();
            }
            else
            {
                SignImage.ImageUrl      = Path.Combine(ConfigReader.SingLocation, "Notavailable.JPG").ToString();
                tdCIP.InnerHtml         = "";
                leftDataGrid.Visible    = false;
                dvContentBottom.Visible = false;
                //  PhotoImage.ImageUrl = Path.Combine(ConfigReader.PhotoLocation, "Notavailable.JPG").ToString();
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", " window.fnResetAll();", true);
            }
        }
        else
        {
            totalUnitsTextBox.Text   = "";
            renewalUnitsTextBox.Text = "";
            dvContentBottom.Visible  = false;
            leftDataGrid.Visible     = false;
            ClearText();
            SignImage.ImageUrl = Path.Combine(ConfigReader.SingLocation, "Notavailable.JPG").ToString();
            ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('Invalid Registration Number');", true);
        }
    }
    protected void findButton_Click(object sender, EventArgs e)
    {
        UnitHolderRegistration regObj = new UnitHolderRegistration();

        regObj.FundCode   = fundCodeDDL.SelectedValue.ToString();
        regObj.BranchCode = branchCodeDDL.SelectedValue.ToString();
        regObj.RegNumber  = regNoTextBox.Text.Trim();
        regObj.BO         = holderBOTextBox.Text.ToString().Trim();

        DataTable dtValidSearch = opendMFDAO.dtValidSearch(regObj);

        if (dtValidSearch.Rows.Count > 0)
        {
            regObj            = new UnitHolderRegistration();
            regObj.FundCode   = fundCodeDDL.SelectedValue.ToString();
            regObj.BranchCode = branchCodeDDL.SelectedValue.ToString();
            regObj.RegNumber  = dtValidSearch.Rows[0]["REG_NO"].ToString();
            DataTable dtRegInfo = opendMFDAO.getDtRegInfo(regObj);

            regNoTextBox.Text    = dtRegInfo.Rows[0]["REG_NO"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["REG_NO"].ToString();
            holderBOTextBox.Text = dtRegInfo.Rows[0]["BO"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["BO"].ToString();

            NameTextBox.Text = dtRegInfo.Rows[0]["HNAME"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["HNAME"].ToString();
            string string1 = dtRegInfo.Rows[0]["ADDRS1"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["ADDRS1"].ToString();
            string string2 = dtRegInfo.Rows[0]["ADDRS2"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["ADDRS2"].ToString();
            string string3 = dtRegInfo.Rows[0]["CITY"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["CITY"].ToString();
            addressTextBox.Text = string1.ToString() + " " + string2 + " " + string3;

            if (!dtRegInfo.Rows[0]["SELLING_AGENT_ID"].Equals(DBNull.Value))
            {
                agentNameDDL.DataSource     = unitSaleBLObj.dtSellingAgentInfoforDDL();
                agentNameDDL.DataTextField  = "NAME";
                agentNameDDL.DataValueField = "ID";
                agentNameDDL.SelectedValue  = dtRegInfo.Rows[0]["SELLING_AGENT_ID"].ToString();
                agentNameDDL.DataBind();
                agentNameDDL.Enabled            = false;
                sellingAgentCodeTextBox.Text    = dtRegInfo.Rows[0]["SELLING_AGENT_ID"].ToString();
                sellingAgentCodeTextBox.Enabled = false;
            }
            else
            {
                sellingAgentCodeTextBox.Enabled = true;
                sellingAgentCodeTextBox.Text    = "";

                agentNameDDL.Enabled        = true;
                agentNameDDL.DataSource     = unitSaleBLObj.dtSellingAgentInfoforDDL();
                agentNameDDL.DataTextField  = "NAME";
                agentNameDDL.DataValueField = "ID";
                agentNameDDL.SelectedValue  = "0";
                agentNameDDL.DataBind();
            }
        }
        else
        {
            regNoTextBox.Text    = "";
            holderBOTextBox.Text = "";
            NameTextBox.Text     = "";
            addressTextBox.Text  = "";
            ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('Invalid Registration Number OR BO ');", true);
        }
    }
    public void displayRegInfo(UnitHolderRegistration unitRegObj)
    {
        dvLedger.Visible = true;


        DataTable dtRegInfo = opendMFDAO.getDtRegInfo(unitRegObj);
        DataTable dtNominee = opendMFDAO.dtNomineeRegInfo(unitRegObj);

        if (dtRegInfo.Rows.Count > 0)
        {
            //Trasaction Lock Status

            if (!(dtRegInfo.Rows[0]["ALL_LOCK"].Equals(DBNull.Value) || (dtRegInfo.Rows[0]["ALL_LOCK"].ToString() == "N")) || !(dtRegInfo.Rows[0]["SL_LOCK"].Equals(DBNull.Value) || (dtRegInfo.Rows[0]["SL_LOCK"].ToString() == "N")) || !(dtRegInfo.Rows[0]["REP_LOCK"].Equals(DBNull.Value) || (dtRegInfo.Rows[0]["REP_LOCK"].ToString() == "N")) || !(dtRegInfo.Rows[0]["TR_LOCK"].Equals(DBNull.Value) || (dtRegInfo.Rows[0]["TR_LOCK"].ToString() == "N")) || !(dtRegInfo.Rows[0]["LIEN_LOCK"].Equals(DBNull.Value) || (dtRegInfo.Rows[0]["LIEN_LOCK"].ToString() == "N")) || !(dtRegInfo.Rows[0]["REN_LOCK"].Equals(DBNull.Value) || (dtRegInfo.Rows[0]["REN_LOCK"].ToString() == "N")) || !(dtRegInfo.Rows[0]["LOCK_REMARKS"].Equals(DBNull.Value)))
            {
                dvLockin.Attributes.Add("style", "visibility:visible");
                if (dtRegInfo.Rows[0]["ALL_LOCK"].ToString() == "Y")
                {
                    SaleLockLabel.Text      = "YES";
                    RepLockLabel.Text       = "YES";
                    TransferLockLabel.Text  = "YES";
                    LienLockLabel.Text      = "YES";
                    RenLockLabel.Text       = "YES";
                    LockRemarksTextBox.Text = dtRegInfo.Rows[0]["LOCK_REMARKS"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["LOCK_REMARKS"].ToString();
                }
                else
                {
                    if (dtRegInfo.Rows[0]["SL_LOCK"].ToString() == "Y")
                    {
                        SaleLockLabel.Text = "YES";
                    }
                    else
                    {
                        SaleLockLabel.Text = "NO";
                    }
                    if (dtRegInfo.Rows[0]["REP_LOCK"].ToString() == "Y")
                    {
                        RepLockLabel.Text = "YES";
                    }
                    else
                    {
                        RepLockLabel.Text = "NO";
                    }
                    if (dtRegInfo.Rows[0]["TR_LOCK"].ToString() == "Y")
                    {
                        TransferLockLabel.Text = "YES";
                    }
                    else
                    {
                        TransferLockLabel.Text = "NO";
                    }
                    if (dtRegInfo.Rows[0]["LIEN_LOCK"].ToString() == "Y")
                    {
                        LienLockLabel.Text = "YES";
                    }
                    else
                    {
                        LienLockLabel.Text = "NO";
                    }

                    if (dtRegInfo.Rows[0]["REN_LOCK"].ToString() == "Y")
                    {
                        RenLockLabel.Text = "YES";
                    }
                    else
                    {
                        RenLockLabel.Text = "NO";
                    }



                    LockRemarksTextBox.Text = dtRegInfo.Rows[0]["LOCK_REMARKS"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["LOCK_REMARKS"].ToString();
                }
            }
            else
            {
                SaleLockLabel.Text     = "NO";
                RepLockLabel.Text      = "NO";
                TransferLockLabel.Text = "NO";
                LienLockLabel.Text     = "NO";
                RenLockLabel.Text      = "NO";
                dvLockin.Attributes.Add("style", "visibility:hidden");
            }
            regNoTextBox.Text          = dtRegInfo.Rows[0]["REG_NO"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["REG_NO"].ToString();
            holderBOTextBox.Text       = dtRegInfo.Rows[0]["BO"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["BO"].ToString();
            folioTextBox.Text          = dtRegInfo.Rows[0]["FOLIO_NO"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["FOLIO_NO"].ToString();
            holderNameTextBox.Text     = dtRegInfo.Rows[0]["HNAME"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["HNAME"].ToString();
            jHolderTextBox.Text        = dtRegInfo.Rows[0]["JNT_NAME"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["JNT_NAME"].ToString();
            holderAddress1TextBox.Text = dtRegInfo.Rows[0]["ADDRS1"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["ADDRS1"].ToString();
            holderAddress2TextBox.Text = dtRegInfo.Rows[0]["ADDRS2"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["ADDRS2"].ToString();
            holderTelphoneTextBox.Text = dtRegInfo.Rows[0]["TEL_NO"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["TEL_NO"].ToString();
            tdTIN.InnerHtml            = dtRegInfo.Rows[0]["TIN"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["TIN"].ToString();
            string CIP   = dtRegInfo.Rows[0]["CIP"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["CIP"].ToString();
            string BEFTN = dtRegInfo.Rows[0]["IS_BEFTN"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["IS_BEFTN"].ToString();
            if (string.Compare(CIP, "Y", true) == 0)
            {
                tdCIP.InnerHtml = "YES";
            }
            else if (string.Compare(CIP, "N", true) == 0)
            {
                tdCIP.InnerHtml = "NO";
            }
            else
            {
                tdCIP.InnerHtml = " ";
            }
            if (string.Compare(BEFTN, "Y", true) == 0)
            {
                tdBEFTN.InnerHtml = "YES";
            }
            else
            {
                tdBEFTN.InnerHtml = "NO";
            }
            if (dtNominee.Rows.Count > 1)
            {
                Nominee1NameTextBox.Text = dtNominee.Rows[0]["NOMI_NAME"].ToString();
                Nominee2NameTextBox.Text = dtNominee.Rows[1]["NOMI_NAME"].ToString();
            }
            else if (dtNominee.Rows.Count > 0)
            {
                Nominee1NameTextBox.Text = dtNominee.Rows[0]["NOMI_NAME"].ToString();
                Nominee2NameTextBox.Text = "";
            }
            else
            {
                Nominee1NameTextBox.Text = "";
                Nominee2NameTextBox.Text = "";
            }
            RemarksTextBox.Text = dtRegInfo.Rows[0]["REMARKS"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["REMARKS"].ToString();
            if (dtRegInfo.Rows[0]["BK_FLAG"].ToString() == "Y")
            {
                string bankInfo = "";
                if (!dtRegInfo.Rows[0]["BK_NM_CD"].Equals(DBNull.Value) && !dtRegInfo.Rows[0]["BK_BR_NM_CD"].Equals(DBNull.Value) && !dtRegInfo.Rows[0]["BK_AC_NO"].Equals(DBNull.Value))
                {
                    bankInfo = "AC:" + dtRegInfo.Rows[0]["BK_AC_NO"].ToString();
                    bankInfo = bankInfo + " , " + reportObj.getBankNameByBankCode(Convert.ToInt32(dtRegInfo.Rows[0]["BK_NM_CD"].ToString())).ToString();
                    bankInfo = bankInfo + " , " + reportObj.getBankBranchNameByCode(Convert.ToInt32(dtRegInfo.Rows[0]["BK_NM_CD"].ToString()), Convert.ToInt32(dtRegInfo.Rows[0]["BK_BR_NM_CD"].ToString())).ToString();

                    DataTable dtBankBracnhInfo = unitHolderRegBLObj.dtGetBankBracnhInfo(Convert.ToInt32(dtRegInfo.Rows[0]["BK_NM_CD"].ToString()), Convert.ToInt32(dtRegInfo.Rows[0]["BK_BR_NM_CD"].ToString()));
                    if (dtBankBracnhInfo.Rows.Count > 0)
                    {
                        bankInfo = bankInfo + " Routing No=[" + dtBankBracnhInfo.Rows[0]["ROUTING_NO"].ToString() + "] " + dtBankBracnhInfo.Rows[0]["ADDRESS"].ToString() + " ";
                    }
                }
                BankInfoTextBox.Text = bankInfo.ToString();
            }
            else
            {
                BankInfoTextBox.Text = "";
            }

            DataTable dtLedger = reportObj.GetLedgerData(unitRegObj);
            int       balance  = 0;
            if (dtLedger.Rows.Count > 0)
            {
                DataTable dtLedgerForReport = reportObj.GetDtLedgerTable();
                DataRow   drLedgerForReport;
                for (int looper = 0; looper < dtLedger.Rows.Count; looper++)
                {
                    drLedgerForReport       = dtLedgerForReport.NewRow();
                    drLedgerForReport["SI"] = looper + 1;
                    if (!dtLedger.Rows[looper]["TRANS_DATE"].Equals(DBNull.Value))
                    {
                        drLedgerForReport["TRANS_DATE"] = Convert.ToDateTime(dtLedger.Rows[looper]["TRANS_DATE"].ToString()).ToString("dd-MMM-yyyy");
                    }

                    drLedgerForReport["TRANS_NO"] = Convert.ToInt32(dtLedger.Rows[looper]["TRANS_NO"].Equals(DBNull.Value) ? "0" : dtLedger.Rows[looper]["TRANS_NO"].ToString());
                    //drLedgerForReport["TRANS_NO"] = Convert.ToInt32(dtLedgerForReport.Rows[looper]["TRANS_DATE"].Equals(DBNull.Value) ? "0" : dtLedgerForReport.Rows[looper]["TRANS_DATE"].ToString());
                    if (!dtLedger.Rows[looper]["TRANS_TYPE"].Equals(DBNull.Value))
                    {
                        drLedgerForReport["TRANS_TYPE"] = dtLedger.Rows[looper]["TRANS_TYPE"].ToString();
                        if ((string.Compare(dtLedger.Rows[looper]["TRANS_TYPE"].ToString(), "SL", true) == 0) || (string.Compare(dtLedger.Rows[looper]["TRANS_TYPE"].ToString(), "CIP", true) == 0))
                        {
                            drLedgerForReport["UNIT_CREDIT"] = Convert.ToInt32(dtLedger.Rows[looper]["QTY"].Equals(DBNull.Value) ? "0" : dtLedger.Rows[looper]["QTY"].ToString());
                            drLedgerForReport["RATE"]        = decimal.Parse((dtLedger.Rows[looper]["RATE"].ToString()));

                            int saleBalance = Convert.ToInt32(dtLedger.Rows[looper]["QTY"].Equals(DBNull.Value) ? "0" : dtLedger.Rows[looper]["QTY"].ToString());
                            balance = balance + saleBalance;
                            drLedgerForReport["BALANCE"] = balance;
                        }
                        else if (string.Compare(dtLedger.Rows[looper]["TRANS_TYPE"].ToString(), "TRI", true) == 0)
                        {
                            drLedgerForReport["UNIT_CREDIT"] = Convert.ToInt32(dtLedger.Rows[looper]["QTY"].Equals(DBNull.Value) ? "0" : dtLedger.Rows[looper]["QTY"].ToString());
                            //drLedgerForReport["RATE"] = Convert.ToInt32(dtLedgerForReport.Rows[looper]["RATE"].ToString());
                            int transferInBalance = Convert.ToInt32(dtLedger.Rows[looper]["QTY"].Equals(DBNull.Value) ? "0" : dtLedger.Rows[looper]["QTY"].ToString());
                            balance = balance + transferInBalance;
                            drLedgerForReport["BALANCE"] = balance;
                        }
                        else if (string.Compare(dtLedger.Rows[looper]["TRANS_TYPE"].ToString(), "TRO", true) == 0)
                        {
                            drLedgerForReport["UNIT_DEBIT"] = Convert.ToInt32(dtLedger.Rows[looper]["QTY"].Equals(DBNull.Value) ? "0" : dtLedger.Rows[looper]["QTY"].ToString());
                            //drLedgerForReport["RATE"] = Convert.ToInt32(dtLedgerForReport.Rows[looper]["RATE"].ToString());
                            int transferOutBalance = Convert.ToInt32(dtLedger.Rows[looper]["QTY"].Equals(DBNull.Value) ? "0" : dtLedger.Rows[looper]["QTY"].ToString());
                            balance = balance - transferOutBalance;
                            drLedgerForReport["BALANCE"] = balance;
                        }
                        else if (string.Compare(dtLedger.Rows[looper]["TRANS_TYPE"].ToString(), "REP", true) == 0)
                        {
                            drLedgerForReport["UNIT_DEBIT"] = Convert.ToInt32(dtLedger.Rows[looper]["QTY"].Equals(DBNull.Value) ? "0" : dtLedger.Rows[looper]["QTY"].ToString());
                            drLedgerForReport["RATE"]       = decimal.Parse((dtLedger.Rows[looper]["RATE"].ToString()));
                            int repurchaseBalance = Convert.ToInt32(dtLedger.Rows[looper]["QTY"].Equals(DBNull.Value) ? "0" : dtLedger.Rows[looper]["QTY"].ToString());
                            balance = balance - repurchaseBalance;
                            drLedgerForReport["BALANCE"] = balance;
                        }
                    }
                    dtLedgerForReport.Rows.Add(drLedgerForReport);
                }
                TotalLienUnitHoldingTextBox.Text = unitLienBLObj.totalLienAmount(unitRegObj).ToString();
                dgLedger.DataSource = dtLedgerForReport;
                dgLedger.DataBind();
                Session["dtLedgerForReport"] = dtLedgerForReport;
                displaySign();
            }
            else
            {
                ClearText();
                SignImage.ImageUrl = encrypt.PhotoBase64ImgSrc(Path.Combine(ConfigReader.SingLocation, "Notavailable.JPG").ToString());
                dvLedger.Visible   = false;
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('No Ledger Balance Data Found');", true);
            }
        }

        else
        {
            SignImage.ImageUrl = encrypt.PhotoBase64ImgSrc(Path.Combine(ConfigReader.SingLocation, "Notavailable.JPG").ToString());
            dvLedger.Visible   = false;
            ClientScript.RegisterStartupScript(this.GetType(), "Popup", " window.fnResetAll();", true);
            tdCIP.InnerHtml = "";
        }
    }
    public void displayRegInfo()
    {
        dvLedger.Visible = true;
        UnitHolderRegistration unitRegObj = new UnitHolderRegistration();

        unitRegObj.FundCode   = fundCodeTextBox.Text.Trim();
        unitRegObj.BranchCode = branchCodeTextBox.Text.Trim();
        unitRegObj.RegNumber  = regNoTextBox.Text.Trim();
        DataTable dtRegInfo = opendMFDAO.getDtRegInfo(unitRegObj);
        DataTable dtNominee = opendMFDAO.dtNomineeRegInfo(unitRegObj);

        if (dtRegInfo.Rows.Count > 0)
        {
            holderNameTextBox.Text     = dtRegInfo.Rows[0]["HNAME"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["HNAME"].ToString();
            jHolderTextBox.Text        = dtRegInfo.Rows[0]["JNT_NAME"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["JNT_NAME"].ToString();
            holderAddress1TextBox.Text = dtRegInfo.Rows[0]["ADDRS1"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["ADDRS1"].ToString();
            holderAddress2TextBox.Text = dtRegInfo.Rows[0]["ADDRS2"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["ADDRS2"].ToString();
            holderTelphoneTextBox.Text = dtRegInfo.Rows[0]["TEL_NO"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["TEL_NO"].ToString();
            string CIP = dtRegInfo.Rows[0]["CIP"].Equals(DBNull.Value) ? "" : dtRegInfo.Rows[0]["CIP"].ToString();
            if (string.Compare(CIP, "Y", true) == 0)
            {
                tdCIP.InnerHtml = "YES";
            }
            else if (string.Compare(CIP, "N", true) == 0)
            {
                tdCIP.InnerHtml = "NO";
            }
            if (dtNominee.Rows.Count > 1)
            {
                Nominee1NameTextBox.Text = dtNominee.Rows[0]["NOMI_NAME"].ToString();
                Nominee2NameTextBox.Text = dtNominee.Rows[1]["NOMI_NAME"].ToString();
            }
            else if (dtNominee.Rows.Count > 0)
            {
                Nominee1NameTextBox.Text = dtNominee.Rows[0]["NOMI_NAME"].ToString();
                Nominee2NameTextBox.Text = "";
            }
            else
            {
                Nominee1NameTextBox.Text = "";
                Nominee2NameTextBox.Text = "";
            }
            DataTable dtLedger = reportObj.GetLedgerData(unitRegObj);
            int       balance  = 0;
            if (dtLedger.Rows.Count > 0)
            {
                DataTable dtLedgerForReport = reportObj.GetDtLedgerTable();
                DataRow   drLedgerForReport;
                for (int looper = 0; looper < dtLedger.Rows.Count; looper++)
                {
                    drLedgerForReport       = dtLedgerForReport.NewRow();
                    drLedgerForReport["SI"] = looper + 1;
                    if (!dtLedger.Rows[looper]["TRANS_DATE"].Equals(DBNull.Value))
                    {
                        drLedgerForReport["TRANS_DATE"] = Convert.ToDateTime(dtLedger.Rows[looper]["TRANS_DATE"].ToString()).ToString("dd-MMM-yyyy");
                    }

                    drLedgerForReport["TRANS_NO"] = Convert.ToInt32(dtLedger.Rows[looper]["TRANS_NO"].Equals(DBNull.Value) ? "0" : dtLedger.Rows[looper]["TRANS_NO"].ToString());
                    //drLedgerForReport["TRANS_NO"] = Convert.ToInt32(dtLedgerForReport.Rows[looper]["TRANS_DATE"].Equals(DBNull.Value) ? "0" : dtLedgerForReport.Rows[looper]["TRANS_DATE"].ToString());
                    if (!dtLedger.Rows[looper]["TRANS_TYPE"].Equals(DBNull.Value))
                    {
                        drLedgerForReport["TRANS_TYPE"] = dtLedger.Rows[looper]["TRANS_TYPE"].ToString();
                        if ((string.Compare(dtLedger.Rows[looper]["TRANS_TYPE"].ToString(), "SL", true) == 0) || (string.Compare(dtLedger.Rows[looper]["TRANS_TYPE"].ToString(), "CIP", true) == 0))
                        {
                            drLedgerForReport["UNIT_CREDIT"] = Convert.ToInt32(dtLedger.Rows[looper]["QTY"].Equals(DBNull.Value) ? "0" : dtLedger.Rows[looper]["QTY"].ToString());
                            drLedgerForReport["RATE"]        = decimal.Parse((dtLedger.Rows[looper]["RATE"].ToString()));

                            int saleBalance = Convert.ToInt32(dtLedger.Rows[looper]["QTY"].Equals(DBNull.Value) ? "0" : dtLedger.Rows[looper]["QTY"].ToString());
                            balance = balance + saleBalance;
                            drLedgerForReport["BALANCE"] = balance;
                        }
                        else if (string.Compare(dtLedger.Rows[looper]["TRANS_TYPE"].ToString(), "TRI", true) == 0)
                        {
                            drLedgerForReport["UNIT_CREDIT"] = Convert.ToInt32(dtLedger.Rows[looper]["QTY"].Equals(DBNull.Value) ? "0" : dtLedger.Rows[looper]["QTY"].ToString());
                            //drLedgerForReport["RATE"] = Convert.ToInt32(dtLedgerForReport.Rows[looper]["RATE"].ToString());
                            int transferInBalance = Convert.ToInt32(dtLedger.Rows[looper]["QTY"].Equals(DBNull.Value) ? "0" : dtLedger.Rows[looper]["QTY"].ToString());
                            balance = balance + transferInBalance;
                            drLedgerForReport["BALANCE"] = balance;
                        }
                        else if (string.Compare(dtLedger.Rows[looper]["TRANS_TYPE"].ToString(), "TRO", true) == 0)
                        {
                            drLedgerForReport["UNIT_DEBIT"] = Convert.ToInt32(dtLedger.Rows[looper]["QTY"].Equals(DBNull.Value) ? "0" : dtLedger.Rows[looper]["QTY"].ToString());
                            //drLedgerForReport["RATE"] = Convert.ToInt32(dtLedgerForReport.Rows[looper]["RATE"].ToString());
                            int transferOutBalance = Convert.ToInt32(dtLedger.Rows[looper]["QTY"].Equals(DBNull.Value) ? "0" : dtLedger.Rows[looper]["QTY"].ToString());
                            balance = balance - transferOutBalance;
                            drLedgerForReport["BALANCE"] = balance;
                        }
                        else if (string.Compare(dtLedger.Rows[looper]["TRANS_TYPE"].ToString(), "REP", true) == 0)
                        {
                            drLedgerForReport["UNIT_DEBIT"] = Convert.ToInt32(dtLedger.Rows[looper]["QTY"].Equals(DBNull.Value) ? "0" : dtLedger.Rows[looper]["QTY"].ToString());
                            drLedgerForReport["RATE"]       = decimal.Parse((dtLedger.Rows[looper]["RATE"].ToString()));
                            int repurchaseBalance = Convert.ToInt32(dtLedger.Rows[looper]["QTY"].Equals(DBNull.Value) ? "0" : dtLedger.Rows[looper]["QTY"].ToString());
                            balance = balance - repurchaseBalance;
                            drLedgerForReport["BALANCE"] = balance;
                        }
                    }
                    dtLedgerForReport.Rows.Add(drLedgerForReport);
                }
                TotalLienUnitHoldingTextBox.Text = unitLienBLObj.totalLienAmount(unitRegObj).ToString();
                dgLedger.DataSource = dtLedgerForReport;
                dgLedger.DataBind();
                Session["dtLedgerForReport"] = dtLedgerForReport;
                displaySign();
            }
            else
            {
                ClearText();
                SignImage.ImageUrl = Path.Combine(ConfigReader.SingLocation, "Notavailable.JPG").ToString();
                dvLedger.Visible   = false;
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('No Ledger Balance Data Found');", true);
            }
        }

        else
        {
            SignImage.ImageUrl = Path.Combine(ConfigReader.SingLocation, "Notavailable.JPG").ToString();
            dvLedger.Visible   = false;
            ClientScript.RegisterStartupScript(this.GetType(), "Popup", " window.fnResetAll();", true);
            tdCIP.InnerHtml = "";
        }
    }