Esempio n. 1
0
    protected void SaveButton_Click(object sender, EventArgs e)
    {
        int Error_Count = 0;

        try
        {
            commonGatewayObj.BeginTransaction();

            DataTable dtMPDSE = (DataTable)Session["dtMPDSE"];
            // Hashtable htInsertMP = new Hashtable();
            Hashtable htUpdateMP = new Hashtable();
            if (!pfolioBLObj.getMPUpdateStatus(marketPriceDateTextBox.Text.ToString(), "DSE"))
            {
                for (int loop = 0; loop < dtMPDSE.Rows.Count; loop++)
                {
                    if (Convert.ToInt32(dtMPDSE.Rows[loop]["COMP_CD"].ToString()) > 0)
                    {
                        string high = dtMPDSE.Rows[loop]["HIGH"].ToString();
                        htUpdateMP.Add("RT_UPD_DT", marketPriceDateTextBox.Text.ToString());
                        htUpdateMP.Add("AVG_RT", Convert.ToDecimal(dtMPDSE.Rows[loop]["CLOSE"].ToString()));
                        if (dtMPDSE.Rows[loop]["HIGH"].ToString() != "")
                        {
                            htUpdateMP.Add("DSE_HIGH", Convert.ToDecimal(dtMPDSE.Rows[loop]["HIGH"].ToString()));
                        }
                        if (dtMPDSE.Rows[loop]["LOW"].ToString() != "")
                        {
                            htUpdateMP.Add("DSE_LOW", Convert.ToDecimal(dtMPDSE.Rows[loop]["LOW"].ToString()));
                        }
                        if (dtMPDSE.Rows[loop]["OPEN"].ToString() != "")
                        {
                            htUpdateMP.Add("DSE_OPEN", Convert.ToDecimal(dtMPDSE.Rows[loop]["OPEN"].ToString()));
                        }

                        commonGatewayObj.Update(htUpdateMP, "COMP", "COMP_CD=" + Convert.ToInt32(dtMPDSE.Rows[loop]["COMP_CD"].ToString()));
                        htUpdateMP = new Hashtable();
                    }

                    Error_Count = loop;
                }
                commonGatewayObj.CommitTransaction();
                dvGridDSEMPInfo.Visible = false;
                dsePriceLabel.Text      = "Price  Save Successfully";
                dsePriceLabel.Style.Add("color", "#009933");
            }
            else
            {
                dsePriceLabel.Text = "Price Already Saved On That Date";
                dsePriceLabel.Style.Add("color", "red");
            }
        }
        catch (Exception ex)
        {
            int errrrr = Error_Count;
            // dvGridDSEMPInfo.Visible = false;
            commonGatewayObj.RollbackTransaction();
            dsePriceLabel.Text = "Price  Save failed Error:" + ex.Message.ToString();
            dsePriceLabel.Style.Add("color", "red");
        }
    }
    protected void AdviceButton_Click(object sender, EventArgs e)
    {
        DataTable dtBEFTNAdviceData = unitRepBLObj.dtGetBEFTNAdviceData("AND B.BEFTN_TRACKING_NO IS NULL AND B.BEFTN_DATE='" + BEFTNDateDropDownList.SelectedValue.ToString() + "' AND A.FUND_CD='" + fundNameDropDownList.SelectedValue.ToString() + "'");

        if (dtBEFTNAdviceData.Rows.Count > 0)
        {
            try
            {
                long beftnTrackingNumber = commonGatewayObj.GetMaxNo("REPURCHASE", "BEFTN_TRACKING_NO") + 1;
                commonGatewayObj.BeginTransaction();
                Hashtable htUpdate = new Hashtable();
                htUpdate.Add("BEFTN_TRACKING_NO", beftnTrackingNumber);
                commonGatewayObj.Update(htUpdate, "REPURCHASE ", "REG_BK='" + fundNameDropDownList.SelectedValue.ToString() + "' AND  BEFTN_TRACKING_NO IS NULL AND BEFTN_DATE='" + BEFTNDateDropDownList.SelectedValue.ToString() + "' ");
                commonGatewayObj.CommitTransaction();

                // Session["dtBEFTNAdviceData"] = dtBEFTNAdviceData;
                Session["BEFTN_DATE"]        = BEFTNDateDropDownList.SelectedValue.ToString();
                Session["BEFTN_TRACKING_NO"] = beftnTrackingNumber.ToString();
                Session["FUND_CD"]           = fundNameDropDownList.SelectedValue.ToString();
                ClientScript.RegisterStartupScript(this.GetType(), "UnitReportTaxCert", "window.open('ReportViewer/UnitReportRepurchaseBEFTNAdviceLetterReportViewer.aspx')", true);
            }
            catch (Exception ex)
            {
                commonGatewayObj.RollbackTransaction();
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Popup", "alert ('Print Fail:" + ex.Message.Replace("'", "").ToString() + "');", true);
            }
        }
        else
        {
            Session["BEFTN_DATE"]        = null;
            Session["BEFTN_TRACKING_NO"] = null;
            Session["FUND_CD"]           = null;
            ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert('No Data Found');", true);
        }
    }
Esempio n. 3
0
    public void InsertCdblData(DataTable dtCDBLdata)
    {
        try
        {
            long SI = commonGatewayObj.GetMaxNo("CDBL_DATA", "ID") + 1;
            commonGatewayObj.BeginTransaction();
            Hashtable htCdblData = new Hashtable();
            for (int loop = 0; loop < dtCDBLdata.Rows.Count; loop++)
            {
                htCdblData.Add("ID", SI);
                htCdblData.Add("FUND_CODE", fundNameDropDownList.SelectedValue.ToString());
                htCdblData.Add("DIVI_NO", ClosingDateDropDownList.SelectedValue.ToString());
                htCdblData.Add("FY", DividendFYDropDownList.SelectedItem.Text);
                htCdblData.Add("RECORD_DATE", ClosingDateDropDownList.SelectedItem.Text);
                htCdblData.Add("BO", dtCDBLdata.Rows[loop]["BO"]);
                htCdblData.Add("NAME1", dtCDBLdata.Rows[loop]["NAME1"]);
                htCdblData.Add("BALANCE", dtCDBLdata.Rows[loop]["BALANCE"]);
                htCdblData.Add("BO_TYPE", dtCDBLdata.Rows[loop]["BO_TYPE"]);
                htCdblData.Add("BO_CATAGORY", dtCDBLdata.Rows[loop]["BO_CATAGORY"]);
                htCdblData.Add("ADDRESS1", dtCDBLdata.Rows[loop]["ADDRESS1"]);
                htCdblData.Add("ADDRESS2", dtCDBLdata.Rows[loop]["ADDRESS2"]);
                htCdblData.Add("ADDRESS3", dtCDBLdata.Rows[loop]["ADDRESS3"]);
                htCdblData.Add("CITY", dtCDBLdata.Rows[loop]["CITY"]);
                htCdblData.Add("COUNTRY", dtCDBLdata.Rows[loop]["COUNTRY"]);
                htCdblData.Add("POST_CODE", dtCDBLdata.Rows[loop]["POST_CODE"]);
                htCdblData.Add("PHONE1", dtCDBLdata.Rows[loop]["PHONE1"]);
                htCdblData.Add("PHONE2", dtCDBLdata.Rows[loop]["PHONE2"]);
                htCdblData.Add("RESIDENCY", dtCDBLdata.Rows[loop]["RESIDENCY"]);
                htCdblData.Add("BANK", dtCDBLdata.Rows[loop]["BANK_NAME"]);
                htCdblData.Add("BRANCH", dtCDBLdata.Rows[loop]["BRANCH_NAME"]);
                htCdblData.Add("BANK_ACC", dtCDBLdata.Rows[loop]["BANK_ACC_NO"]);
                htCdblData.Add("ROUTING_NO", dtCDBLdata.Rows[loop]["ROUTING_NO"]);

                htCdblData.Add("NAME2", dtCDBLdata.Rows[loop]["NAME2"]);
                htCdblData.Add("GENDER", dtCDBLdata.Rows[loop]["GENDER"]);
                htCdblData.Add("BO_NATIONALITY", dtCDBLdata.Rows[loop]["BO_NATIONALITY"]);
                htCdblData.Add("ETIN", dtCDBLdata.Rows[loop]["ETIN"]);
                htCdblData.Add("IS_VALID_ETIN", dtCDBLdata.Rows[loop]["IS_VALID_ETIN"]);

                htCdblData.Add("REG_BK", dtCDBLdata.Rows[loop]["REG_BK"]);
                htCdblData.Add("REG_BR", dtCDBLdata.Rows[loop]["REG_BR"]);
                htCdblData.Add("REG_NO", dtCDBLdata.Rows[loop]["REG_NO"]);
                htCdblData.Add("NO_OF_REGNO", dtCDBLdata.Rows[loop]["NO_OF_REGNO"]);

                commonGatewayObj.Insert(htCdblData, "CDBL_DATA");
                htCdblData = new Hashtable();
                SI++;
            }
            Hashtable htDividendParaUpdate = new Hashtable();
            //htDividendParaUpdate.Add("IS_UPLOAD_CDBL_DATA", "Y");
            // commonGatewayObj.Update(htDividendParaUpdate, "DIVIDEND_PARA", "FUND_CODE=" + Convert.ToInt32(fundNameDropDownList.SelectedValue.ToString()) + " AND FY='" + fyDropDownList.Text.ToString() + "'AND RECORD_DATE='" + recordDateDropDownList.Text.ToString() + "'");
            commonGatewayObj.CommitTransaction();
            ClientScript.RegisterStartupScript(this.GetType(), "Popup", "alert('CDBL Data Save Successfully');", true);
        }
        catch (Exception ex)
        {
            commonGatewayObj.RollbackTransaction();
            //  ClientScript.RegisterStartupScript(this.GetType(), "Popup", "alert ('" + msgObj.Error().ToString() + " " + ex.ToString() + "');", true);
        }
    }
Esempio n. 4
0
    public void InsertHowlaData(DataTable dtTradeCusData)
    {
        if (dtTradeCusData.Rows.Count > 0)
        {
            try
            {
                //long SI = Convert.ToInt32(dividendDAOObj.GetMaxSI("CDBL_DATA", "ID")) + 1;
                int numberOfRows = 0;
                commonGatewayObj.BeginTransaction();
                Hashtable htTradeCusData = new Hashtable();
                for (int loop = 0; loop < dtTradeCusData.Rows.Count; loop++)
                {
                    //htTradeCusData.Add("ID", SI);
                    htTradeCusData.Add("F_CD", Convert.ToInt32(dtTradeCusData.Rows[loop]["F_CD"].ToString()));
                    htTradeCusData.Add("SP_DATE", dtTradeCusData.Rows[loop]["SP_DATE"].ToString());
                    htTradeCusData.Add("BK_REF", dtTradeCusData.Rows[loop]["BK_REF"].ToString().ToUpper());
                    htTradeCusData.Add("HOWLA_NO", dtTradeCusData.Rows[loop]["HOWLA_NO"].ToString());
                    htTradeCusData.Add("HOWLA_TP", dtTradeCusData.Rows[loop]["HOWLA_TP"].ToString());
                    htTradeCusData.Add("IN_OUT", dtTradeCusData.Rows[loop]["IN_OUT"].ToString().ToUpper());
                    htTradeCusData.Add("SETTLE_DT", dtTradeCusData.Rows[loop]["SETTLE_DT"].ToString());
                    htTradeCusData.Add("COMP_CD", Convert.ToInt32(dtTradeCusData.Rows[loop]["COMP_CD"].ToString()));
                    htTradeCusData.Add("SP_QTY", dtTradeCusData.Rows[loop]["SP_QTY"].ToString());
                    htTradeCusData.Add("SP_RATE", dtTradeCusData.Rows[loop]["SP_RATE"].ToString());
                    htTradeCusData.Add("CL_DATE", dtTradeCusData.Rows[loop]["CL_DATE"].ToString());
                    htTradeCusData.Add("BK_CD", dtTradeCusData.Rows[loop]["BK_CD"].ToString());
                    htTradeCusData.Add("HOWLA_CHG", dtTradeCusData.Rows[loop]["HOWLA_CHG"].ToString());
                    htTradeCusData.Add("LAGA_CHG", dtTradeCusData.Rows[loop]["LAGA_CHG"].ToString());
                    htTradeCusData.Add("VOUCH_REF", dtTradeCusData.Rows[loop]["VOUCH_REF"].ToString());
                    htTradeCusData.Add("OP_NAME", dtTradeCusData.Rows[loop]["OP_NAME"].ToString());
                    htTradeCusData.Add("N_P", dtTradeCusData.Rows[loop]["N_P"].ToString());
                    htTradeCusData.Add("ISIN_CD", dtTradeCusData.Rows[loop]["ISIN_CD"].ToString());
                    htTradeCusData.Add("FORGN_FLG", dtTradeCusData.Rows[loop]["FORGN_FLG"].ToString());
                    htTradeCusData.Add("SPOT_ID", dtTradeCusData.Rows[loop]["SPOT_ID"].ToString());
                    htTradeCusData.Add("INSTR_GRP", dtTradeCusData.Rows[loop]["INSTR_GRP"].ToString());
                    htTradeCusData.Add("MARKT_TP", dtTradeCusData.Rows[loop]["MARKT_TP"].ToString());
                    htTradeCusData.Add("CUSTOMER", dtTradeCusData.Rows[loop]["CUSTOMER"].ToString());
                    htTradeCusData.Add("BOID", dtTradeCusData.Rows[loop]["BOID"].ToString());

                    commonGatewayObj.Insert(htTradeCusData, "TEST.HOWLA");
                    htTradeCusData = new Hashtable();
                    // SI++;
                    numberOfRows++;
                }
                //Hashtable htDividendParaUpdate = new Hashtable();
                //htDividendParaUpdate.Add("IS_UPLOAD_CDBL_DATA", "Y");
                //commonGatewayObj.Update(htDividendParaUpdate, "DIVIDEND_PARA", "FUND_CODE=" + Convert.ToInt32(fundNameDropDownList.SelectedValue.ToString()) + " AND FY='" + fyDropDownList.Text.ToString() + "'AND RECORD_DATE='" + recordDateDropDownList.Text.ToString() + "'");
                commonGatewayObj.CommitTransaction();
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert('" + numberOfRows + " Record(s) Save Successfully');", true);
            }
            catch (Exception ex)
            {
                commonGatewayObj.RollbackTransaction();
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('" + msgObj.Error().ToString() + " " + ex.ToString() + "');", true);
            }
        }
        else
        {
            ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert('No Data Found.');", true);
        }
    }
Esempio n. 5
0
    protected void SaveButton_Click(object sender, EventArgs e)
    {
        Hashtable htPriceRefixation = new Hashtable();

        try
        {
            commonGatewayObj.BeginTransaction();
            htPriceRefixation.Add("FUND_CD", fundNameDropDownList.SelectedValue.ToString().ToUpper());
            htPriceRefixation.Add("FUND_NM", opendMFDAO.GetFundName(fundNameDropDownList.SelectedValue.ToString()));
            htPriceRefixation.Add("REFIX_DT", Convert.ToDateTime(PriceDateTextBox.Text.ToString()).ToString("dd-MMM-yyyy"));
            htPriceRefixation.Add("REFIX_SL_PR", Convert.ToDecimal(SalePriceTextBox.Text.Trim().ToString()));
            htPriceRefixation.Add("REFIX_REP_PR", Convert.ToDecimal(RepPriceTextBox.Text.Trim().ToString()));
            htPriceRefixation.Add("USER_NM", userObj.UserID.ToString());
            htPriceRefixation.Add("ENT_DT", DateTime.Today.ToString("dd-MMM-yyyy"));
            htPriceRefixation.Add("ENT_TM", DateTime.Now.ToShortTimeString());
            commonGatewayObj.Insert(htPriceRefixation, "PRICE_REFIX");
            commonGatewayObj.CommitTransaction();

            PriceDateTextBox.Text = "";
            SalePriceTextBox.Text = "";
            RepPriceTextBox.Text  = "";
            fundNameDropDownList.Focus();
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Popup", "alert('" + msgObj.Success().ToString() + "');", true);
        }
        catch (Exception ex)
        {
            commonGatewayObj.RollbackTransaction();
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Popup", "alert ('" + msgObj.Error().ToString() + " " + ex.Message.Replace("'", "").ToString() + "');", true);
        }
    }
Esempio n. 6
0
    protected void SubmitButton_Click(object sender, EventArgs e)
    {
        Hashtable htUpdate = new Hashtable();

        try
        {
            bool isDupliacteDRF = unitSaleBLObj.CheckDuplicateSaleRelatedInfo(" AND SALE.REG_BK='" + fundCode + "' AND SALE.DRF_ACCEPT_NO='" + DRFNoTextBox.Text + "'");
            bool isDupliacteDRN = unitSaleBLObj.CheckDuplicateSaleRelatedInfo(" AND SALE.REG_BK='" + fundCode + "' AND SALE.DRF_DRN ='" + DRNTextBox.Text + "'");

            if (isDupliacteDRF)
            {
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('Save Failed Due to Duplicate DRF No');", true);
            }
            else if (isDupliacteDRN)
            {
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('Save Failed Due to Duplicate DRN');", true);
            }

            else
            {
                commonGatewayObj.BeginTransaction();

                htUpdate = new Hashtable();
                htUpdate.Add("DRF_ACCEPT_ENTRY_BY", userObj.UserID.ToString());
                htUpdate.Add("DRF_ACCEPT_ENTRY_DATE", DateTime.Now);
                htUpdate.Add("DRF_ACCEPT_NO", DRFNoTextBox.Text.Trim().ToString());
                htUpdate.Add("DRF_DRN", DRNTextBox.Text.Trim().ToString());
                htUpdate.Add("DRF_ACCEPT_DATE", DamateDateTextBox.Text.Trim().ToString());


                commonGatewayObj.Update(htUpdate, "SALE", "REG_BK='" + fundCode.ToUpper().ToString() + "' AND REG_BR='" + branchCode.ToUpper().ToString() + "' AND SALE.DRF_REF_NO=" + DRRefNoDropDownList.SelectedValue.ToString());

                commonGatewayObj.CommitTransaction();
                DRRefNoDropDownList.DataSource     = unitSaleBLObj.dtDRRefNoListForDRN("AND SALE.REG_BK='" + fundCode + "'");
                DRRefNoDropDownList.DataTextField  = "NAME";
                DRRefNoDropDownList.DataValueField = "ID";
                DRRefNoDropDownList.DataBind();

                DRFNoTextBox.Text      = "";
                DRNTextBox.Text        = "";
                DamateDateTextBox.Text = "";
                FolioNoLabel.Text      = "";
                CertNoLabel.Text       = "";
                DistinctNoToLabel.Text = "";
                DistNoFromLabel.Text   = "";
                TotalUnitLabel.Text    = "";
                DataTable dtSaleInfoForDRF = unitSaleBLObj.dtGetSaleInfoForDemate(" AND SALE.REG_BK='" + fundCode + "' AND SALE.REG_BR='" + branchCode + "' AND SALE.DRF_REF_NO=0");
                SaleListGridView.DataSource = dtSaleInfoForDRF;
                SaleListGridView.DataBind();
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert('Save Successfully');", true);
            }
        }
        catch (Exception ex)
        {
            commonGatewayObj.RollbackTransaction();
            ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('Save Failed Due to Error:" + ex.Message.ToString() + "');", true);
        }
    }
Esempio n. 7
0
    protected void SubmitButton_Click(object sender, EventArgs e)
    {
        int  countCheck         = 0;
        int  countUpdateRow     = 0;
        bool isDupliacteDRRefNo = unitSaleBLObj.CheckDuplicateSaleRelatedInfo(" AND SALE.REG_BK='" + fundCode + "' AND DRF_REF_NO=" + Convert.ToInt64(DRFRefNoTextBox.Text.ToString()));

        if (!isDupliacteDRRefNo)
        {
            Hashtable htUpdate = new Hashtable();
            try
            {
                commonGatewayObj.BeginTransaction();
                foreach (GridViewRow Drv in SaleListGridView.Rows)
                {
                    CheckBox leftCheckBox = (CheckBox)SaleListGridView.Rows[countCheck].FindControl("leftCheckBox");

                    if (leftCheckBox.Checked)
                    {
                        htUpdate = new Hashtable();
                        htUpdate.Add("DRF_REQ_BY", userObj.UserID.ToString());
                        htUpdate.Add("DRF_REQ_DATE", DateTime.Now);
                        htUpdate.Add("HOLDER_BO", Drv.Cells[6].Text.ToUpper().ToString());
                        htUpdate.Add("DRF_REF_NO", Convert.ToInt64(DRFRefNoTextBox.Text.ToString()));

                        commonGatewayObj.Update(htUpdate, "SALE", "REG_BK='" + Drv.Cells[1].Text.ToUpper().ToString() + "' AND REG_BR='" + Drv.Cells[2].Text.ToUpper().ToString() + "' AND REG_NO=" + Convert.ToInt32(Drv.Cells[3].Text.ToString()) + " AND SL_NO=" + Convert.ToInt32(Drv.Cells[4].Text.ToString()));
                        countUpdateRow++;
                    }

                    countCheck++;
                }
                if (countUpdateRow == 0)
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('Save Failed Due No Sale Selection ');", true);
                }
                else
                {
                    commonGatewayObj.CommitTransaction();
                    DataTable dtSaleInfoForDRF = unitSaleBLObj.dtGetSaleInfoForDRF(" AND SALE.REG_BK='" + fundCode + "' AND SALE.REG_BR='" + branchCode + "' AND SALE.SL_NO BETWEEN 0 AND 0");
                    SaleListGridView.DataSource = dtSaleInfoForDRF;
                    SaleListGridView.DataBind();
                    DRFRefNoTextBox.Text   = "";
                    toSaleNoTextBox.Text   = "";
                    fromSaleNoTextBox.Text = "";
                    ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert('Save Successfully');", true);
                }
            }
            catch (Exception ex)
            {
                commonGatewayObj.RollbackTransaction();
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('Save Failed:" + ex.Message.ToString() + "');", true);
            }
        }
        else
        {
            ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('Save Failed:Duplicate DR Reference Number ');", true);
        }
    }
Esempio n. 8
0
    protected void SubmitButton_Click(object sender, EventArgs e)
    {
        int       countCheck = 0;
        Hashtable htUpdate   = new Hashtable();

        try
        {
            foreach (GridViewRow Drv in SaleListGridView.Rows)
            {
                TextBox TRSeqNoTextBox = (TextBox)SaleListGridView.Rows[countCheck].FindControl("TRSeqNoTextBox");

                bool isDupliacteTrSeqNo = unitSaleBLObj.CheckDuplicateSaleRelatedInfo(" AND SALE.REG_BK='" + fundCode + "' AND SALE.DRF_TR_SEQ_NO='" + TRSeqNoTextBox.Text + "'");


                if (isDupliacteTrSeqNo)
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('Save Failed Due to Duplicate Transfer Sequence Number:" + TRSeqNoTextBox.Text + "');", true);
                    break;
                }

                else
                {
                    commonGatewayObj.BeginTransaction();

                    htUpdate = new Hashtable();
                    htUpdate.Add("DRF_TR_ENTRY_BY", userObj.UserID.ToString());
                    htUpdate.Add("DRF_TR_ENTRY_DATE", DateTime.Now);
                    htUpdate.Add("DRF_TR_SEQ_NO", TRSeqNoTextBox.Text.Trim().ToString());
                    htUpdate.Add("DRF_TR_DATE", TransferDateTextBox.Text.Trim().ToString());

                    commonGatewayObj.Update(htUpdate, "SALE", "REG_BK='" + fundCode.ToUpper().ToString() + "' AND REG_BR='" + branchCode.ToUpper().ToString() + "' AND SALE.DRF_REF_NO=" + DRRefNoDropDownList.SelectedValue.ToString());
                }
                commonGatewayObj.CommitTransaction();
                DRRefNoDropDownList.DataSource     = unitSaleBLObj.dtDRRefNoListForFolioTransfer("AND SALE.REG_BK='" + fundCode + "'");
                DRRefNoDropDownList.DataTextField  = "NAME";
                DRRefNoDropDownList.DataValueField = "ID";
                DRRefNoDropDownList.DataBind();

                TRSeqFromNoTextBox.Text  = "";
                TransferDateTextBox.Text = "";


                DataTable dtSaleInfoForDRF = unitSaleBLObj.dtGetSaleInfoForDemate(" AND SALE.REG_BK='" + fundCode + "' AND SALE.REG_BR='" + branchCode + "' AND SALE.DRF_REF_NO=0");
                SaleListGridView.DataSource = dtSaleInfoForDRF;
                SaleListGridView.DataBind();
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert('Save Successfully');", true);

                countCheck++;
            }
        }
        catch (Exception ex)
        {
            commonGatewayObj.RollbackTransaction();
            ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('Save Failed Due to Error:" + ex.Message.ToString() + "');", true);
        }
    }
Esempio n. 9
0
    protected void savetButton_Click(object sender, EventArgs e)
    {
        try
        {
            if (unitRepprtObj.CheckDuplicate(refixationDateTextBox.Text))
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Popup", "alert('Save Failed: Duplicate Price Refixaton Date');", true);
            }
            else
            {
                Hashtable htInsert   = new Hashtable();
                int       countCheck = 0;
                commonGatewayObj.BeginTransaction();
                foreach (GridViewRow Drv in SurrenderListGridView.Rows)
                {
                    htInsert.Add("NAV_DATE", NAVDateTextBox.Text);
                    htInsert.Add("REFIX_DT", refixationDateTextBox.Text);
                    htInsert.Add("FUND_CD", Drv.Cells[0].Text.ToString());
                    htInsert.Add("FUND_NM", Drv.Cells[1].Text.ToString());

                    TextBox effectDateTextBox     = (TextBox)SurrenderListGridView.Rows[countCheck].FindControl("effectDateTextBox");
                    TextBox salePriceTextBox      = (TextBox)SurrenderListGridView.Rows[countCheck].FindControl("salePriceTextBox");
                    TextBox surrenderPriceTextBox = (TextBox)SurrenderListGridView.Rows[countCheck].FindControl("surrenderPriceTextBox");
                    TextBox navMPTextBox          = (TextBox)SurrenderListGridView.Rows[countCheck].FindControl("navMPTextBox");
                    TextBox navCPTextBox          = (TextBox)SurrenderListGridView.Rows[countCheck].FindControl("navCPTextBox");

                    htInsert.Add("EFFECTIVE_DATE", Convert.ToDateTime(effectDateTextBox.Text).ToString("dd-MMM-yyyy"));
                    htInsert.Add("REFIX_SL_PR", Convert.ToDecimal(salePriceTextBox.Text.ToString()));
                    htInsert.Add("REFIX_REP_PR", Convert.ToDecimal(surrenderPriceTextBox.Text.ToString()));
                    htInsert.Add("NAV_MP", Convert.ToDecimal(navMPTextBox.Text.ToString()));
                    htInsert.Add("NAV_CP", Convert.ToDecimal(navCPTextBox.Text.ToString()));

                    htInsert.Add("USER_NM", userObj.UserID.ToString());
                    htInsert.Add("ENT_DT", DateTime.Today.ToString("dd-MMM-yyyy"));
                    htInsert.Add("ENT_TM", DateTime.Now.ToShortTimeString());

                    commonGatewayObj.Insert(htInsert, "PRICE_REFIX");
                    commonGatewayObj.CommitTransaction();
                    htInsert = new Hashtable();
                    countCheck++;
                }
            }

            refixationDateTextBox.Text = "";
            NAVDateTextBox.Text        = "";
            dvGridSurrender.Visible    = false;
            ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "Popup", "alert('Save Successfully');", true);
        }
        catch (Exception ex)
        {
            commonGatewayObj.RollbackTransaction();
            throw ex;
        }
    }
    protected void SaveButton_Click(object sender, EventArgs e)
    {
        try
        {
            commonGatewayObj.BeginTransaction();
            Hashtable htDeliveryInfo   = new Hashtable();
            DataTable dtDividendLedger = (DataTable)Session["dtDividendLedger"];
            int       countRow         = 0;
            if (dtDividendLedger.Rows.Count > 0)
            {
                foreach (DataGridItem gridRow in dgLedger.Items)
                {
                    CheckBox leftCheckBox = (CheckBox)gridRow.FindControl("leftCheckBox");
                    if (leftCheckBox.Checked)
                    {
                        htDeliveryInfo.Add("WAR_DELEVARY_DT", Convert.ToDateTime(dateTextBox.Text.Trim()).ToString("dd-MMM-yyyy"));
                        htDeliveryInfo.Add("WAR_BK_PAY_USER", userObj.UserID.ToString());
                        if (selfRadioButton.Checked)
                        {
                            htDeliveryInfo.Add("WARR_RECPT_BY", "SELF");
                        }
                        else
                        {
                            htDeliveryInfo.Add("WARR_RECPT_BY", authorizeTextBox.Text.Trim().ToString());
                        }

                        commonGatewayObj.Update(htDeliveryInfo, "DIVIDEND", "REG_BK='" + fundCodeDDL.SelectedValue.ToString() + "' AND DIVI_NO=" + Convert.ToInt32(dtDividendLedger.Rows[countRow]["DIVI_NO"]) + " AND REG_NO=" + Convert.ToInt32(regNoTextBox.Text.Trim()) + " AND WAR_NO=" + Convert.ToInt32(dtDividendLedger.Rows[countRow]["WAR_NO"]));
                    }
                    htDeliveryInfo = new Hashtable();
                    countRow++;
                }

                commonGatewayObj.CommitTransaction();
                dvLedger.Visible        = false;
                totalRowCountLabel.Text = "0";
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert('Save Successfully');", true);
            }
            else
            {
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert('No Data Found to Save');", true);
            }
        }
        catch (Exception ex)
        {
            // dvGridAttendenceInfo.Visible = false;
            ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('" + msgObj.Error().ToString() + " " + ex.Message.Replace("'", "").ToString() + "');", true);
        }
    }
    protected void AuditButton_Click(object sender, EventArgs e)
    {
        int       countCheck = 0;
        Hashtable htUpdate   = new Hashtable();

        try
        {
            commonGatewayObj.BeginTransaction();
            foreach (GridViewRow Drv in SurrenderListGridView.Rows)
            {
                CheckBox leftCheckBox = (CheckBox)SurrenderListGridView.Rows[countCheck].FindControl("leftCheckBox");

                if (leftCheckBox.Checked)
                {
                    htUpdate = new Hashtable();
                    htUpdate.Add("AUDITED_BY", userObj.UserID.ToString());
                    htUpdate.Add("AUDITED_DATE", DateTime.Now);
                    commonGatewayObj.Update(htUpdate, "REPURCHASE ", "REG_BK='" + Drv.Cells[2].Text.ToUpper().ToString() + "' AND REG_BR='" + Drv.Cells[3].Text.ToUpper().ToString() + "' AND REG_NO=" + Convert.ToInt32(Drv.Cells[4].Text.ToString()) + " AND REP_NO=" + Convert.ToInt32(Drv.Cells[5].Text.ToString()));
                }

                countCheck++;
            }
            commonGatewayObj.CommitTransaction();
            if (fundNameDropDownList.SelectedValue.ToString() != "0")
            {
                DataTable dtChequeData = unitRepBLObj.dtGetChequePaymentData("AND A.AUDITED_BY IS  NULL AND FUND_INFO.FUND_CD='" + fundNameDropDownList.SelectedValue.ToString() + "'");
                SurrenderListGridView.DataSource = dtChequeData;
                SurrenderListGridView.DataBind();
            }
            else
            {
                DataTable dtChequeData = unitRepBLObj.dtGetChequePaymentData("AND A.AUDITED_BY IS  NULL ");

                SurrenderListGridView.DataSource = dtChequeData;
                SurrenderListGridView.DataBind();
            }
            ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert('Save Successfully');", true);
        }
        catch (Exception ex)
        {
            commonGatewayObj.RollbackTransaction();

            ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('Save Failed');", true);
        }
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        string strBalanceDate, strLastBalDate, strLastUpadateDate, strLastUpadatePlusOneDate, strUpdateFundTransHB, strDelFromFundFolioHB, strMarketPriceDate, temp;

        DateTime?     dtimeBalanceDate, dtimeLastBalDate, dtimeLastUpadateDate, dtimeLastUpadatePlusOneDate, dtMarketPriceDate;
        DataTable     dtFromFundTransHB = new DataTable();
        DataTable     dtFromFundFolioHB = new DataTable();
        CommonGateway commonGatewayObj  = new CommonGateway();
        DataTable     dtSource          = new DataTable();
        DataTable     dtSource2         = new DataTable();

        try
        {
            if (!string.IsNullOrEmpty(txtBalanceDate.Text.Trim()))
            {
                dtimeBalanceDate = Convert.ToDateTime(txtBalanceDate.Text.ToString());

                strBalanceDate = dtimeBalanceDate.Value.ToString("dd-MMM-yyyy");
            }
            else
            {
                dtimeBalanceDate = null;
                strBalanceDate   = "";
            }

            if (!string.IsNullOrEmpty(txtLastBalDate.Text.Trim()))
            {
                dtimeLastBalDate = Convert.ToDateTime(txtLastBalDate.Text.ToString());
                strLastBalDate   = dtimeLastBalDate.Value.ToString("dd-MMM-yyyy");
            }
            else
            {
                dtimeLastBalDate = null;
                strLastBalDate   = "";
            }
            if (!string.IsNullOrEmpty(txtLastUpadateDate.Text.Trim()))
            {
                dtimeLastUpadateDate        = Convert.ToDateTime(txtLastUpadateDate.Text.ToString());
                strLastUpadateDate          = dtimeLastUpadateDate.Value.ToString("dd-MMM-yyyy");
                dtimeLastUpadatePlusOneDate = dtimeLastUpadateDate.Value.AddDays(1);
                strLastUpadatePlusOneDate   = dtimeLastUpadatePlusOneDate.Value.ToString("dd-MMM-yyyy");
            }
            else
            {
                dtimeLastUpadateDate        = null;
                strLastUpadateDate          = "";
                dtimeLastUpadatePlusOneDate = null;
                strLastUpadatePlusOneDate   = "";
            }

            if (!string.IsNullOrEmpty(txtMarketPriceDate.Text.Trim()))
            {
                dtMarketPriceDate  = Convert.ToDateTime(txtMarketPriceDate.Text.ToString());
                strMarketPriceDate = dtMarketPriceDate.Value.ToString("dd-MMM-yyyy");
            }
            else
            {
                dtMarketPriceDate  = null;
                strMarketPriceDate = "";
            }
            if (dtimeBalanceDate > dtimeLastBalDate)
            {
                temp = adv_proc1(strLastUpadatePlusOneDate, strBalanceDate, fundNameDropDownList.SelectedValue.ToString());
                if (temp.Trim() == "Processing Completed")
                {
                    lblProcessing.Text = "Processing completed!!!!";
                    // ClearFields();
                }
                else
                {
                    lblProcessing.Text = "No data found!!!!";
                    //  ClearFields();
                }
                //lblProcessing.Text = "Processing completed!!!!";
                //ClearFields();
            }

            else
            {
                commonGatewayObj.BeginTransaction();
                strDelFromFundFolioHB = "delete from fund_folio_hb where f_cd =" + fundNameDropDownList.SelectedValue.ToString();
                int noDelRowsFromFundFolioHB = commonGatewayObj.ExecuteNonQuery(strDelFromFundFolioHB);

                strUpdateFundTransHB = "update fund_trans_hb set cost_rate = null,crt_aft_com = null where f_cd =" + fundNameDropDownList.SelectedValue.ToString();
                int noUpdRowsFundTransHB = commonGatewayObj.ExecuteNonQuery(strUpdateFundTransHB);
                commonGatewayObj.CommitTransaction();

                temp = adv_proc1(strLastUpadatePlusOneDate, strBalanceDate, fundNameDropDownList.SelectedValue.ToString());
                if (temp.Trim() == "Processing Completed")
                {
                    lblProcessing.Text = "Processing completed!!!!";
                    // ClearFields();
                }
                else
                {
                    lblProcessing.Text = "No data found!!!!";
                    //   ClearFields();
                }
                //  lblProcessing.Text = "Processing completed!!!!";


                // Code goes here Code goes here
            }



            string strCompnayTransdate = "select a.comp_cd, max(a.tran_date) tran_date from market_price a, fund_folio_hb b where a.comp_cd = b.comp_cd and b.f_cd =" + fundNameDropDownList.SelectedValue.ToString() + " and a.tran_date <= '" + strBalanceDate + "' group by a.comp_cd order by a.comp_cd";

            dtSource = commonGatewayObj.Select(strCompnayTransdate);

            List <CompanayTransdate>  lstCompnayTransdate = new List <CompanayTransdate>();
            List <CompanyAvarageRate> lstCompnayAvgrate   = new List <CompanyAvarageRate>();
            lstCompnayTransdate = (from DataRow dr in dtSource.Rows
                                   select new CompanayTransdate()
            {
                COMP_CD = dr["COMP_CD"].ToString(),
                TRAN_DATE = dr["TRAN_DATE"].ToString()
            }).ToList();

            string dltQuery     = "delete from mprice_temp where f_cd=" + fundNameDropDownList.SelectedValue.ToString();
            int    dltNumOfRows = commonGatewayObj.ExecuteNonQuery(dltQuery);

            foreach (CompanayTransdate comtransdate in lstCompnayTransdate)
            {
                string strInsQuery = "select " + fundNameDropDownList.SelectedValue.ToString() + " as FundId, comp_cd, avg_rt from  market_price where comp_cd = " + comtransdate.COMP_CD + " and tran_date = '" + Convert.ToDateTime(comtransdate.TRAN_DATE).ToString("dd-MMM-yyyy") + "'";

                dtSource2 = commonGatewayObj.Select(strInsQuery);

                lstCompnayAvgrate = (from DataRow dr in dtSource2.Rows
                                     select new CompanyAvarageRate()
                {
                    FUNDID = dr["FUNDID"].ToString(),
                    COMP_CD = dr["COMP_CD"].ToString(),
                    AVG_RT = dr["AVG_RT"].ToString()
                }).ToList();


                foreach (CompanyAvarageRate comAvgrate in lstCompnayAvgrate)
                {
                    string strQueryInsMprice_Temp = "insert into mprice_temp(f_cd, comp_cd, avg_rt) values ('" + comAvgrate.FUNDID + "','" + comAvgrate.COMP_CD + "','" + comAvgrate.AVG_RT + "')";
                    int    NumOfRows = commonGatewayObj.ExecuteNonQuery(strQueryInsMprice_Temp);
                }
            }
            string   LoginID = Session["UserID"].ToString();
            DateTime dtimeCurrentDateTimeForLog = DateTime.Now;
            string   strCurrentDateTimeForLog   = dtimeCurrentDateTimeForLog.ToString("dd-MMM-yyyy HH:mm:ss tt", CultureInfo.InvariantCulture);

            //string strupdateQueryfund_control = "update fund_control set bal_dt='" + strBalanceDate + "',mprice_dt='" + strMarketPriceDate + "' where f_cd =" + fundNameDropDownList.SelectedValue.ToString() + "";

            string strupdateQueryfund_control = "update fund_control set op_name='" + LoginID + "',upd_date_time='" + strCurrentDateTimeForLog + "',bal_dt='" + strBalanceDate + "',mprice_dt='" + strMarketPriceDate + "' where f_cd =" + fundNameDropDownList.SelectedValue.ToString() + "";



            int updatefund_controlNumOfRows = commonGatewayObj.ExecuteNonQuery(strupdateQueryfund_control);


            // System.Threading.Thread.Sleep(3000);

            // ClearFields();
        }
        catch (Exception ex)
        {
            ClientScript.RegisterStartupScript(this.GetType(), "Popup", "alert('" + ex.Message.ToString() + "');", true);
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        XmlReader xmlFile;
        DataSet   ds   = new DataSet();
        DataTable dt   = new DataTable();
        Hashtable htdt = new Hashtable();

        xmlFile = XmlReader.Create("D:\\Project\\Web\\AMCL.OPENMF\\AMCL.Web\\Sanction List\\1737.xml", new XmlReaderSettings());
        ds.ReadXml(xmlFile);
        dt = ds.Tables[10];
        try
        {
            commonGatewayObj.BeginTransaction();
            for (int loop = 0; loop < dt.Rows.Count; loop++)
            {
                //if (!dt.Rows[loop]["DATAID"].Equals(DBNull.Value))
                //{
                //    htdt.Add("DATAID", dt.Rows[loop]["DATAID"].ToString());
                //}
                //htdt.Add("VERSIONNUM", Convert.ToInt32(dt.Rows[loop]["VERSIONNUM"].Equals(DBNull.Value) ? "0" : dt.Rows[loop]["VERSIONNUM"].ToString()));
                //if (!dt.Rows[loop]["FIRST_NAME"].Equals(DBNull.Value))
                //{
                //    htdt.Add("FIRST_NAME", dt.Rows[loop]["FIRST_NAME"].ToString());
                //}
                //if (!dt.Rows[loop]["SECOND_NAME"].Equals(DBNull.Value))
                //{
                //    htdt.Add("SECOND_NAME", dt.Rows[loop]["SECOND_NAME"].ToString());
                //}
                //if (!dt.Rows[loop]["THIRD_NAME"].Equals(DBNull.Value))
                //{
                //    htdt.Add("THIRD_NAME", dt.Rows[loop]["THIRD_NAME"].ToString());
                //}
                //if (!dt.Rows[loop]["FOURTH_NAME"].Equals(DBNull.Value))
                //{
                //    htdt.Add("FOURTH_NAME", dt.Rows[loop]["FOURTH_NAME"].ToString());
                ////}
                //if (!dt.Rows[loop]["UN_LIST_TYPE"].Equals(DBNull.Value))
                //{
                //    htdt.Add("UN_LIST_TYPE", dt.Rows[loop]["UN_LIST_TYPE"].ToString());
                //}
                //if (!dt.Rows[loop]["REFERENCE_NUMBER"].Equals(DBNull.Value))
                //{
                //    htdt.Add("REFERENCE_NUMBER", dt.Rows[loop]["REFERENCE_NUMBER"].ToString());
                //}
                //if (!dt.Rows[loop]["LISTED_ON"].Equals(DBNull.Value))
                //{
                //    htdt.Add("LISTED_ON", Convert.ToDateTime(Convert.ToDateTime(dt.Rows[loop]["LISTED_ON"]).ToString("dd-MMM-yyyy")));
                //}
                //if (!dt.Rows[loop]["SUBMITTED_BY"].Equals(DBNull.Value))
                //{
                //    htdt.Add("SUBMITTED_BY", dt.Rows[loop]["SUBMITTED_BY"].ToString());
                //}
                //if (!dt.Rows[loop]["GENDER"].Equals(DBNull.Value))
                //{
                //    htdt.Add("GENDER", dt.Rows[loop]["GENDER"].ToString());
                //}
                //if (!dt.Rows[loop]["NAME_ORIGINAL_SCRIPT"].Equals(DBNull.Value))
                //{
                //    htdt.Add("NAME_ORIGINAL_SCRIPT", dt.Rows[loop]["NAME_ORIGINAL_SCRIPT"].ToString());
                //}
                //if (!dt.Rows[loop]["COMMENTS1"].Equals(DBNull.Value))
                //{
                //    htdt.Add("COMMENTS1", dt.Rows[loop]["COMMENTS1"].ToString());
                //}

                //if (!dt.Rows[loop]["SORT_KEY"].Equals(DBNull.Value))
                //{
                //    htdt.Add("SORT_KEY", dt.Rows[loop]["SORT_KEY"].ToString());
                //}
                //if (!dt.Rows[loop]["NATIONALITY2"].Equals(DBNull.Value))
                //{
                //    htdt.Add("NATIONALITY2", dt.Rows[loop]["NATIONALITY2"].ToString());
                //}
                //htdt.Add("ENTITY_ID", commonGatewayObj.GetMaxNo("SLIST_ENTITY", "ENTITY_ID") + 1);
                //if (!dt.Rows[loop]["SORT_KEY_LAST_MOD"].Equals(DBNull.Value))
                //{
                //    htdt.Add("SORT_KEY_LAST_MOD", dt.Rows[loop]["SORT_KEY_LAST_MOD"].ToString());
                //}
                //commonGatewayObj.Insert(htdt, "SLIST_ENTITY");
                //htdt = new Hashtable();


                //if (!dt.Rows[loop]["NOTE"].Equals(DBNull.Value))
                //{
                //    htdt.Add("NOTE", dt.Rows[loop]["NOTE"].ToString());
                //}

                if (!dt.Rows[loop]["STREET"].Equals(DBNull.Value))
                {
                    htdt.Add("STREET", dt.Rows[loop]["STREET"].ToString());
                }
                if (!dt.Rows[loop]["CITY"].Equals(DBNull.Value))
                {
                    htdt.Add("CITY", dt.Rows[loop]["CITY"].ToString());
                }
                //if (!dt.Rows[loop]["STATE_PROVINCE"].Equals(DBNull.Value))
                //{
                //    htdt.Add("STATE_PROVINCE", dt.Rows[loop]["STATE_PROVINCE"].ToString());
                //}
                //if (!dt.Rows[loop]["ZIP_CODE"].Equals(DBNull.Value))
                //{
                //    htdt.Add("ZIP_CODE", dt.Rows[loop]["ZIP_CODE"].ToString());
                //}
                if (!dt.Rows[loop]["COUNTRY"].Equals(DBNull.Value))
                {
                    htdt.Add("COUNTRY", dt.Rows[loop]["COUNTRY"].ToString());
                }

                htdt.Add("ENTITY_ID", 78 + Convert.ToInt32(dt.Rows[loop]["ENTITY_ID"].ToString()));

                commonGatewayObj.Insert(htdt, "SLIST_ENTITY_ADDRESS");
                htdt = new Hashtable();



                //if (!dt.Rows[loop]["QUALITY"].Equals(DBNull.Value))
                //{
                //    htdt.Add("QUALITY", dt.Rows[loop]["QUALITY"].ToString());
                //}
                //if (!dt.Rows[loop]["ALIAS_NAME"].Equals(DBNull.Value))
                //{
                //    htdt.Add("ALIAS_NAME", dt.Rows[loop]["ALIAS_NAME"].ToString());
                //}
                //if (!dt.Rows[loop]["ENTITY_ID"].Equals(DBNull.Value))
                //{
                //    htdt.Add("ENTITY_ID", dt.Rows[loop]["ENTITY_ID"].ToString());
                //}

                //commonGatewayObj.Insert(htdt, "SLIST_ENTITY_ALIAS");
                //htdt = new Hashtable();
            }
            commonGatewayObj.CommitTransaction();
            ClientScript.RegisterStartupScript(this.GetType(), "Popup", "alert ('success');", true);
        }
        catch (Exception ex)
        {
            commonGatewayObj.RollbackTransaction();
            //errorMassege = msgObj.ExceptionErrorMessageString(ex.Message.ToString());
            ClientScript.RegisterStartupScript(this.GetType(), "Popup", "alert ('Error');", true);
        }
    }
Esempio n. 14
0
        public void SaveUnitSale(UnitHolderRegistration unitRegObj, UnitSale unitSaleObj, DataTable dtDinomination, UnitUser unitUserObj)
        {
            Hashtable htUnitSale     = new Hashtable();
            Hashtable htUnitSaleCert = new Hashtable();
            Hashtable htCertNoTemp   = new Hashtable();
            string    certificate    = "";

            try
            {
                commonGatewayObj.BeginTransaction();

                htUnitSale.Add("REG_BK", unitRegObj.FundCode.ToString().ToUpper());
                htUnitSale.Add("REG_BR", unitRegObj.BranchCode.ToString());
                htUnitSale.Add("REG_NO", unitRegObj.RegNumber.ToString());
                htUnitSale.Add("SL_NO", Convert.ToInt32(unitSaleObj.SaleNo.ToString()));
                htUnitSale.Add("SL_DT", Convert.ToDateTime(unitSaleObj.SaleDate).ToString("dd-MMM-yyyy"));
                htUnitSale.Add("SL_PRICE", Convert.ToDecimal(unitSaleObj.SaleRate.ToString()));
                htUnitSale.Add("QTY", Convert.ToInt32(unitSaleObj.SaleUnitQty.ToString()));
                htUnitSale.Add("SL_TYPE", unitSaleObj.SaleType.ToString().ToUpper());
                htUnitSale.Add("USER_NM", unitUserObj.UserID.ToString());
                htUnitSale.Add("ENT_TM", DateTime.Now.ToShortTimeString().ToString());
                htUnitSale.Add("ENT_DT", DateTime.Now.ToString());

                if (!(unitSaleObj.MoneyReceiptNo.ToString() == "0"))
                {
                    htUnitSale.Add("MONY_RECT_NO", Convert.ToInt32(unitSaleObj.MoneyReceiptNo));
                }

                if (!((unitSaleObj.MoneyReceiptNo.ToString() == "0") && unitSaleObj.PaymentType.ToString() == "CHQ" && unitSaleObj.ChequeNo == null && unitSaleObj.ChequeDate == null))
                {
                    htUnitSale.Add("PAY_TYPE", unitSaleObj.PaymentType);
                }

                if (unitSaleObj.ChequeNo != null)
                {
                    htUnitSale.Add("CHQ_DD_NO", unitSaleObj.ChequeNo);
                }
                if (unitSaleObj.ChequeDate == null)
                {
                    htUnitSale.Add("CHEQUE_DT", DBNull.Value);
                }
                else
                {
                    htUnitSale.Add("CHEQUE_DT", unitSaleObj.ChequeDate);
                }
                if (!(unitSaleObj.BankCode.ToString() == "0"))
                {
                    htUnitSale.Add("BANK_CODE", Convert.ToInt16(unitSaleObj.BankCode));
                }

                if (!(unitSaleObj.BranchCode.ToString() == "0"))
                {
                    htUnitSale.Add("BRANCH_CODE", Convert.ToInt16(unitSaleObj.BranchCode));
                }

                if (!(unitSaleObj.CashAmount.ToString() == "0"))
                {
                    htUnitSale.Add("CASH_AMT", Convert.ToDecimal(unitSaleObj.CashAmount));
                }
                if (unitSaleObj.MultiPayType != null)
                {
                    htUnitSale.Add("MULTI_PAY_REMARKS", unitSaleObj.MultiPayType);
                }

                commonGatewayObj.Insert(htUnitSale, "SALE");

                htCertNoTemp.Add("REG_BK", unitRegObj.FundCode.ToString().ToUpper());
                htCertNoTemp.Add("REG_BR", unitRegObj.BranchCode.ToString());
                htCertNoTemp.Add("REG_NO", unitRegObj.RegNumber.ToString());
                htCertNoTemp.Add("SL_NO", Convert.ToInt32(unitSaleObj.SaleNo.ToString()));


                for (int looper = 0; looper < dtDinomination.Rows.Count; looper++)
                {
                    htUnitSaleCert.Add("REG_BK", unitRegObj.FundCode.ToString().ToUpper());
                    htUnitSaleCert.Add("REG_BR", unitRegObj.BranchCode.ToString());
                    htUnitSaleCert.Add("REG_NO", unitRegObj.RegNumber.ToString());
                    htUnitSaleCert.Add("SL_NO", Convert.ToInt32(unitSaleObj.SaleNo.ToString()));
                    htUnitSaleCert.Add("CERT_TYPE", dtDinomination.Rows[looper]["dino"].ToString().ToUpper());
                    htUnitSaleCert.Add("CERT_NO", Convert.ToInt32(dtDinomination.Rows[looper]["cert_no"].ToString()));
                    htUnitSaleCert.Add("CERTIFICATE", SaleCertNo(Convert.ToInt32(dtDinomination.Rows[looper]["cert_no"].ToString()), dtDinomination.Rows[looper]["dino"].ToString().ToUpper()));
                    htUnitSaleCert.Add("QTY", Convert.ToInt32(dtDinomination.Rows[looper]["cert_weight"].ToString()));
                    htUnitSaleCert.Add("USER_NM", unitUserObj.UserID.ToString());
                    htUnitSaleCert.Add("ENT_TM", DateTime.Now.ToShortTimeString().ToString());
                    htUnitSaleCert.Add("ENT_DT", DateTime.Now.ToString());
                    commonGatewayObj.Insert(htUnitSaleCert, "SALE_CERT");
                    htUnitSaleCert = new Hashtable();
                    if (certificate == "")
                    {
                        certificate = SaleCertNo(Convert.ToInt32(dtDinomination.Rows[looper]["cert_no"].ToString()), dtDinomination.Rows[looper]["dino"].ToString().ToUpper());
                    }
                    else
                    {
                        certificate = certificate + "," + SaleCertNo(Convert.ToInt32(dtDinomination.Rows[looper]["cert_no"].ToString()), dtDinomination.Rows[looper]["dino"].ToString().ToUpper());
                    }
                }
                htCertNoTemp.Add("CERTIFICATE", certificate);
                htCertNoTemp.Add("USER_NM", unitUserObj.UserID.ToString());
                htCertNoTemp.Add("ENT_TM", DateTime.Now.ToShortTimeString().ToString());
                htCertNoTemp.Add("ENT_DT", DateTime.Now.ToString());
                //   commonGatewayObj.Insert(htCertNoTemp, "CERT_NO_TEMP");

                commonGatewayObj.CommitTransaction();
            }
            catch (Exception ex)
            {
                commonGatewayObj.RollbackTransaction();
                throw ex;
            }
        }
Esempio n. 15
0
    protected void PrintSaveButton_Click(object sender, EventArgs e)
    {
        UnitHolderRegistration regObj = new UnitHolderRegistration();

        long      money_Receipt_ID     = 0;
        Hashtable htInsertMoneyReceipt = new Hashtable();

        try
        {
            regObj.FundCode   = fundCodeDDL.SelectedValue.ToString();
            regObj.BranchCode = branchCodeDDL.SelectedValue.ToString();

            if (unitSaleBLObj.CheckDuplicateMoneyReceiptNo(regObj, "TR", Convert.ToInt64(ReceiptNoTextBox.Text.Trim())))
            {
                ClientScript.RegisterStartupScript(this.GetType(), "Popup", "alert('" + msgObj.Duplicate().ToString() + " " + "Receipt Number " + "');", true);
            }
            else
            {
                money_Receipt_ID = commonGatewayObj.GetMaxNo("MONEY_RECEIPT", "ID") + 1;
                commonGatewayObj.BeginTransaction();
                htInsertMoneyReceipt.Add("ID", money_Receipt_ID);
                htInsertMoneyReceipt.Add("RECEIPT_NO", ReceiptNoTextBox.Text.Trim());
                htInsertMoneyReceipt.Add("RECEIPT_TYPE", "TR");
                htInsertMoneyReceipt.Add("RECEIPT_DATE", ReceiptDateTextBox.Text.Trim());
                htInsertMoneyReceipt.Add("REG_BK", fundCodeDDL.SelectedValue.ToString());
                htInsertMoneyReceipt.Add("REG_BR", branchCodeDDL.SelectedValue.ToString());
                htInsertMoneyReceipt.Add("REG_NO", regNoTextBox.Text.Trim());

                if (holderBOTextBox.Text.Trim() != "")
                {
                    htInsertMoneyReceipt.Add("BO", holderBOTextBox.Text.Trim());
                }
                htInsertMoneyReceipt.Add("HNAME", NameTextBox.Text.Trim());
                htInsertMoneyReceipt.Add("ADDRESS", addressTextBox.Text.Trim());


                htInsertMoneyReceipt.Add("REG_BK_I", fundCodeDDL.SelectedValue.ToString());
                htInsertMoneyReceipt.Add("REG_BR_I", branchCodeDDL.SelectedValue.ToString());
                htInsertMoneyReceipt.Add("REG_NO_I", regNoTextBox.Text.Trim());

                if (holderBOTextBox.Text.Trim() != "")
                {
                    htInsertMoneyReceipt.Add("BO_I", holderBOTextBox.Text.Trim());
                }
                htInsertMoneyReceipt.Add("HNAME_I", NameTextBox.Text.Trim());
                htInsertMoneyReceipt.Add("ADDRESS_I", addressTextBox.Text.Trim());


                htInsertMoneyReceipt.Add("UNIT_QTY", QtyTextBox.Text.Trim());
                htInsertMoneyReceipt.Add("TR_CERT_DELIVERY_DT", DeliveryDateTextBox.Text.Trim());
                htInsertMoneyReceipt.Add("SL_TR_RN_NO", SaleTRRNNoTextBox.Text.Trim().ToUpper());
                htInsertMoneyReceipt.Add("RECEIPT_ENTRY_BY", userObj.UserID.ToString());
                htInsertMoneyReceipt.Add("RECEIPT_ENTRY_DATE", DateTime.Today.ToString("dd-MMM-yyyy"));

                commonGatewayObj.Insert(htInsertMoneyReceipt, "MONEY_RECEIPT");
                commonGatewayObj.CommitTransaction();
                ClearText();
                Session["MONEY_RECEIPT_ID"]   = money_Receipt_ID.ToString();
                Session["MONEY_RECEIPT_TYPE"] = "REP";
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "window.open('ReportViewer/UnitReportMoneyReceiptReportViewer.aspx');", true);
            }
        }

        catch (Exception ex)
        {
            commonGatewayObj.RollbackTransaction();
            Session["MONEY_RECEIPT_ID"]   = null;
            Session["MONEY_RECEIPT_TYPE"] = null;
            ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert('Save and print Failed');", true);
        }
    }
    protected void SaveButton_Click(object sender, EventArgs e)
    {
        UnitHolderRegistration regObj = new UnitHolderRegistration();

        UnitRepurchase unitRepObj = new UnitRepurchase();

        regObj.FundCode   = FundCodeTextBox.Text.Trim();
        regObj.BranchCode = BranchCodeTextBox.Text.Trim();
        regObj.RegNumber  = RegNoTextBox.Text.Trim();

        unitRepObj.RepurchaseNo   = Convert.ToInt32(moneyReceipDropDownList.SelectedItem.Text.ToString());
        unitRepObj.RepurchaseRate = decimal.Parse(RepRateTextBox.Text.Trim().ToString());
        unitRepObj.RepurchaseDate = RepDateTextBox.Text.Trim().ToString();
        if (EFTRadioButton.Checked)
        {
            unitRepObj.PayType = "EFT";
        }
        else
        {
            unitRepObj.PayType = "CHQ";
        }

        try
        {
            commonGatewayObj.BeginTransaction();
            if (opendMFDAO.IsValidRegistration(regObj))
            {
                if (unitRepBLObj.IsRepurchaseLock(regObj))
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert('" + msgObj.Error().ToString() + " " + " Repurchase Operation is locked " + "');", true);
                }

                else if (unitRepBLObj.IsDuplicateRepurchase(regObj, unitRepObj))
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert('" + msgObj.Duplicate().ToString() + " " + "Repurchase Number " + "');", true);
                }
                else if (Convert.ToInt64(TotalUnitRepurchaseTextBox.Text.ToString()) <= 0)
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('Save Failed: Surrender Value con not be equal or less than Zero');", true);
                }
                else if (!unitRepBLObj.IsValidBEFTN(regObj, unitRepObj))
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert('" + msgObj.Error().ToString() + " " + "Either No Router Number  or Account Number>13 digits " + "');", true);
                }
                else if (unitRepBLObj.IsIDAccount(regObj, unitRepObj))
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert('" + msgObj.Error().ToString() + " " + "ID Account is not allow to BEFTN " + "');", true);
                }
                else
                {
                    int       CheckCount         = 0;
                    long      surrenderCheckUnit = 0;
                    DataTable dtGrid             = opendMFDAO.getTableDataGridCDS();
                    DataRow   drGrid;
                    foreach (DataGridItem gridRow in leftDataGrid.Items)
                    {
                        CheckBox leftCheckBox = (CheckBox)gridRow.FindControl("leftCheckBox");
                        if (leftCheckBox.Checked)
                        {
                            TextBox SL_TR_NOTxt        = (TextBox)gridRow.FindControl("SL_TR_NoTextBox");
                            TextBox SURRENDER_UNITSTxt = (TextBox)gridRow.FindControl("Sale_UnitsTextBox");
                            TextBox EXIST_UNITSTxt     = (TextBox)gridRow.FindControl("Exist_UnitsTextBox");
                            drGrid                    = dtGrid.NewRow();
                            drGrid["SL_TR_NO"]        = SL_TR_NOTxt.Text.Trim().ToString();
                            drGrid["SURRENDER_UNITS"] = SURRENDER_UNITSTxt.Text.Trim().ToString();
                            drGrid["EXIST_UNITS"]     = EXIST_UNITSTxt.Text.Trim().ToString();
                            dtGrid.Rows.Add(drGrid);
                            surrenderCheckUnit = surrenderCheckUnit + Convert.ToInt64(SURRENDER_UNITSTxt.Text.Trim().ToString());
                            CheckCount++;
                        }
                    }

                    if (CheckCount == 0)
                    {
                        ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('Save Failed: No Surrender Units Selected');", true);
                    }
                    else if (surrenderCheckUnit != Convert.ToInt64(TotalUnitRepurchaseTextBox.Text.ToString()))
                    {
                        ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('Save Failed:  Selected Units Mis Match to Actual Surrender Units');", true);
                    }
                    else if ((CheckCount > 0) && (surrenderCheckUnit != Convert.ToInt64(TotalUnitRepurchaseTextBox.Text.ToString())))
                    {
                        commonGatewayObj.ExecuteNonQuery("UPDATE MONEY_RECEIPT SET SL_REP_TR_RN_NO=" + unitRepObj.RepurchaseNo + "  WHERE ID=" + Convert.ToUInt64(moneyReceipDropDownList.SelectedValue.ToString()));
                        unitRepBLObj.saveRepurchaseCDS(dtGrid, regObj, unitRepObj, userObj);//save Repurchase Data
                        ClearText();
                        commonGatewayObj.CommitTransaction();
                        moneyReceipDropDownList.DataSource     = unitSaleBLObj.dtMoneyRecieptforDDL(" AND REG_BK = '" + regObj.FundCode.ToString().ToUpper() + "' AND REG_BR = '" + regObj.BranchCode.ToString().ToUpper() + "'AND RECEIPT_TYPE = 'REP' AND SL_REP_TR_RN_NO IS NULL  ORDER BY RECEIPT_NO DESC ");
                        moneyReceipDropDownList.DataTextField  = "RECEIPT_NO";
                        moneyReceipDropDownList.DataValueField = "ID";
                        moneyReceipDropDownList.DataBind();

                        leftDataGrid.DataSource = opendMFDAO.getTableDataGridCDS();// hide remaining Data
                        leftDataGrid.DataBind();
                        TotalUnitHoldingTextBox.Text = "";
                        EFTRadioButton.Checked       = true;
                        CHQRadioButton.Checked       = false;

                        ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('Save SuccessFully');", true);
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('Save Failed: Ambiguous Situation');", true);
                    }
                }
            }
            else
            {
                ClearText();
                commonGatewayObj.RollbackTransaction();
                leftDataGrid.DataSource = opendMFDAO.getTableDataGridCDS();// hide remaining Data
                leftDataGrid.DataBind();
                TotalUnitHoldingTextBox.Text = "";
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('Invalid Registration Number');", true);
            }
        }
        catch (Exception ex)
        {
            ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('" + msgObj.Error().ToString() + " " + ex.Message.Replace("'", "").ToString() + "');", true);
        }
    }
    protected void SaveButton_Click(object sender, EventArgs e)
    {
        UnitHolderRegistration regObj = new UnitHolderRegistration();

        regObj.FundCode   = fundCodeTextBox.Text;
        regObj.BranchCode = branchCodeTextBox.Text;
        regObj.RegNumber  = regNoTextBox.Text;



        UnitSale saleObj = new UnitSale();

        saleObj.SaleNo = Convert.ToInt32(saleNumberTextBox.Text.Trim().ToString());
        if (moneyReceipDropDownList.SelectedValue.ToString() != "0")
        {
            saleObj.MoneyReceiptNo = Convert.ToInt32(moneyReceipDropDownList.SelectedItem.Text.ToString());
        }
        if (ChqRadioButton.Checked)
        {
            saleObj.PaymentType = ChequeTypeDropDownList.SelectedValue.ToString();
            if (CHQDDNoRemarksTextBox.Text.Trim() != "")
            {
                saleObj.ChequeNo = CHQDDNoRemarksTextBox.Text.Trim().ToString();
            }
            if (chequeDateTextBox.Text.Trim() != "")
            {
                saleObj.ChequeDate = chequeDateTextBox.Text.Trim().ToString();
            }
            if (bankNameDropDownList.SelectedValue.Trim() != "0")
            {
                saleObj.BankCode = Convert.ToInt16(bankNameDropDownList.SelectedValue.ToString());
            }
            if (branchNameDropDownList.SelectedValue.Trim() != "0" && branchNameDropDownList.SelectedValue.Trim() != "")
            {
                saleObj.BranchCode = Convert.ToInt16(branchNameDropDownList.SelectedValue.ToString());
            }
        }
        else if (CashRadioButton.Checked)
        {
            saleObj.PaymentType = "CASH";
            saleObj.CashAmount  = Convert.ToDecimal(Convert.ToDecimal(saleRateTextBox.Text.Trim().ToString()) * Convert.ToInt32(unitQtyTextBox.Text.Trim().ToString()));
        }
        else if (BothRadioButton.Checked)
        {
            saleObj.PaymentType = "BOTH";
            saleObj.ChequeNo    = CHQDDNoRemarksTextBox.Text.Trim().ToString();
            if (CHQDDNoRemarksTextBox.Text.Trim() != "")
            {
                saleObj.ChequeNo = CHQDDNoRemarksTextBox.Text.Trim().ToString();
            }
            if (chequeDateTextBox.Text.Trim() != "")
            {
                saleObj.ChequeDate = chequeDateTextBox.Text.Trim().ToString();
            }
            if (bankNameDropDownList.SelectedValue.Trim() != "0")
            {
                saleObj.BankCode = Convert.ToInt16(bankNameDropDownList.SelectedValue.ToString());
            }
            if (branchNameDropDownList.SelectedValue.Trim() != "0" || branchNameDropDownList.SelectedValue.Trim() != "")
            {
                saleObj.BranchCode = Convert.ToInt16(branchNameDropDownList.SelectedValue.ToString());
            }
            if (CashAmountTextBox.Text.Trim() != "")
            {
                saleObj.CashAmount = Convert.ToDecimal(CashAmountTextBox.Text.Trim().ToString());
            }
        }
        else if (MultiRadioButton.Checked)
        {
            saleObj.PaymentType = "MULTI";
            if (MultiplePayTypeTextBox.Text.Trim() != "")
            {
                saleObj.MultiPayType = MultiplePayTypeTextBox.Text.Trim().ToString();
            }
        }
        saleObj.SaleRate         = Convert.ToDecimal(saleRateTextBox.Text.Trim().ToString());
        saleObj.SaleType         = saleTypeDropDownList.SelectedValue.ToString().ToUpper();
        saleObj.SaleUnitQty      = Convert.ToInt32(unitQtyTextBox.Text.Trim().ToString());
        saleObj.SaleDate         = saleDateTextBox.Text.Trim().ToString();
        saleObj.SaleRemarks      = saleRemarksTextBox.Text.Trim().ToString();
        saleObj.SellingAgentCode = Convert.ToInt32(sellingAgentCodeTextBox.Text.Trim().ToString());
        int  saleLimitLower  = unitSaleBLObj.SaleLimitLower(regObj);
        long saleLimmitUpper = unitSaleBLObj.SaleLimitUpper(regObj);



        try
        {
            if (unitSaleBLObj.IsSaleLock(regObj))//Cheking Lock in status
            {
                ClientScript.RegisterStartupScript(this.GetType(), "Popup", "alert('" + msgObj.Error().ToString() + " " + " Sale Operation is Locked " + "');", true);
            }
            else if (unitSaleBLObj.IsDuplicateSale(regObj, saleObj))// Checking Duplicate Sale No
            {
                ClientScript.RegisterStartupScript(this.GetType(), "Popup", "alert('" + msgObj.Duplicate().ToString() + " " + "Sale Number " + "');", true);
            }
            else if (saleLimitLower > Convert.ToInt32(unitQtyTextBox.Text.Trim().ToString()) && saleTypeDropDownList.SelectedValue.ToString() == "SL")
            {
                unitQtyTextBox.Focus();
                ClientScript.RegisterStartupScript(this.GetType(), "Popup", "alert('Sale Unit Quantity can not less than " + saleLimitLower.ToString() + "');", true);
            }
            else if (saleLimmitUpper < Convert.ToInt32(unitQtyTextBox.Text.Trim().ToString()))
            {
                unitQtyTextBox.Focus();
                ClientScript.RegisterStartupScript(this.GetType(), "Popup", "alert('Sale Unit Quantity can not greater than " + saleLimmitUpper.ToString() + "');", true);
            }
            else
            {
                int       rowNumber = 1;
                int       line      = 0;
                DataTable dtDino    = opendMFDAO.getTableDinomination();
                DataRow   drDino;
                bool      invalidCert       = false;
                bool      allocateCert      = true;
                bool      bannedCert        = false;
                int       duplicateCerNoReg = 0;
                string    dino  = "";
                string    cerNo = "";
                foreach (DataGridItem gridItem in dinoGridView.Items)
                {
                    drDino = dtDino.NewRow();
                    TextBox txtDino   = null;
                    TextBox txtCert   = null;
                    TextBox txtWeight = null;
                    txtDino           = (TextBox)(gridItem.FindControl("dinoTextBox"));
                    txtCert           = (TextBox)(gridItem.FindControl("certNoTextBox"));
                    txtWeight         = (TextBox)(gridItem.FindControl("weightTextBox"));
                    duplicateCerNoReg = opendMFDAO.duplicateCerNoReg(regObj, txtDino.Text.ToString(), txtCert.Text.ToString());
                    allocateCert      = unitSaleBLObj.IsCertificateAllocate(regObj, txtDino.Text.ToString(), txtCert.Text.ToString());
                    bannedCert        = unitSaleBLObj.IsCertificateBanned(regObj, txtDino.Text.ToString(), txtCert.Text.ToString());
                    if (duplicateCerNoReg == 0)
                    {
                        if (saleTypeDropDownList.SelectedValue.ToString().ToUpper() == "CIP")
                        {
                            if (opendMFDAO.validationDino(txtDino.Text.ToString().ToUpper(), regObj.FundCode.ToString().ToUpper()))
                            {
                                if (allocateCert)
                                {
                                    if (bannedCert)
                                    {
                                        bannedCert = true;
                                        line       = rowNumber;
                                        dino       = txtDino.Text.Trim().ToString();
                                        cerNo      = txtCert.Text.Trim().ToString();
                                        break;
                                    }
                                    else
                                    {
                                        drDino["dino"]        = txtDino.Text.Trim().ToString().ToUpper();
                                        drDino["cert_no"]     = Convert.ToInt32(txtCert.Text.Trim().ToString());
                                        drDino["cert_weight"] = Convert.ToInt32(txtWeight.Text.Trim().ToString());
                                        dtDino.Rows.Add(drDino);
                                        rowNumber++;
                                    }
                                }
                                else
                                {
                                    allocateCert = false;
                                    line         = rowNumber;
                                    dino         = txtDino.Text.Trim().ToString();
                                    cerNo        = txtCert.Text.Trim().ToString();
                                    break;
                                }
                            }
                            else
                            {
                                invalidCert = true;
                                line        = rowNumber;
                                break;
                            }
                        }

                        else if (saleTypeDropDownList.SelectedValue.ToString().ToUpper() == "SL")
                        {
                            if (opendMFDAO.validationDino(txtDino.Text.ToString().ToUpper(), regObj.FundCode.ToString().ToUpper()) && opendMFDAO.validationWeight(Convert.ToInt32(txtWeight.Text.ToString()), regObj.FundCode.ToString().ToUpper()))
                            {
                                if (allocateCert)
                                {
                                    if (bannedCert)
                                    {
                                        bannedCert = true;
                                        line       = rowNumber;
                                        dino       = txtDino.Text.Trim().ToString();
                                        cerNo      = txtCert.Text.Trim().ToString();
                                        break;
                                    }
                                    else
                                    {
                                        drDino["dino"]        = txtDino.Text.Trim().ToString().ToUpper();
                                        drDino["cert_no"]     = Convert.ToInt32(txtCert.Text.Trim().ToString());
                                        drDino["cert_weight"] = Convert.ToInt32(txtWeight.Text.Trim().ToString());
                                        dtDino.Rows.Add(drDino);
                                        rowNumber++;
                                    }
                                }
                                else
                                {
                                    allocateCert = false;
                                    line         = rowNumber;
                                    dino         = txtDino.Text.Trim().ToString();
                                    cerNo        = txtCert.Text.Trim().ToString();
                                    break;
                                }
                            }
                            else
                            {
                                invalidCert = true;
                                line        = rowNumber;
                                break;
                            }
                        }
                    }
                    else
                    {
                        dino  = txtDino.Text.Trim().ToString();
                        cerNo = txtCert.Text.Trim().ToString();
                        break;
                    }
                }

                if (duplicateCerNoReg > 0)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "Popup", "alert('Certificate " + dino + "-" + cerNo + " is Already Sold to Reg No:" + duplicateCerNoReg + "');", true);
                }
                else
                {
                    if (invalidCert)
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "Popup", "alert('Save Failed!!Invalid Dinomination or Weight at Line: " + line + "');", true);
                    }
                    else if (!allocateCert)
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "Popup", "alert('Save Failed!! Line: " + line + " and Certificate No: " + dino + "-" + cerNo + " is not allocated in this branch');", true);
                    }
                    else if (bannedCert)
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "Popup", "alert('Save Failed!! Line: " + line + " and Certificate No: " + dino + "-" + cerNo + " is banned for sale');", true);
                    }
                    else if (!invalidCert && allocateCert && !bannedCert)
                    {
                        commonGatewayObj.BeginTransaction();
                        commonGatewayObj.ExecuteNonQuery("UPDATE U_MASTER SET SELLING_AGENT_ID=" + saleObj.SellingAgentCode + "  WHERE  REG_BK='" + regObj.FundCode + "' AND REG_BR='" + regObj.BranchCode + "' AND REG_NO='" + regObj.RegNumber + "' AND SELLING_AGENT_ID IS NULL");
                        commonGatewayObj.ExecuteNonQuery("UPDATE MONEY_RECEIPT SET SL_REP_TR_RN_NO=" + saleObj.SaleNo + "  WHERE ID=" + Convert.ToUInt64(moneyReceipDropDownList.SelectedValue.ToString()));
                        unitSaleBLObj.SaveUnitSale(regObj, saleObj, dtDino, userObj);
                        commonGatewayObj.CommitTransaction();

                        ClearText();
                        moneyReceipDropDownList.DataSource     = unitSaleBLObj.dtMoneyRecieptInfoforDDL(regObj, "SL");
                        moneyReceipDropDownList.DataTextField  = "RECEIPT_NO";
                        moneyReceipDropDownList.DataValueField = "ID";
                        moneyReceipDropDownList.DataBind();

                        ClientScript.RegisterStartupScript(this.GetType(), "Popup", "alert('" + msgObj.Success().ToString() + "');", true);
                    }
                }
            }
        }
        catch (Exception ex)
        {
            commonGatewayObj.RollbackTransaction();
            errorMassege = msgObj.ExceptionErrorMessageString(ex.Message.ToString());
            ClientScript.RegisterStartupScript(this.GetType(), "Popup", "alert ('" + msgObj.Error().ToString() + " " + errorMassege.ToString() + "');", true);
        }
    }
Esempio n. 18
0
    public void SaveSaleUniAccountVoucher(string accountSchema)
    {
        try
        {
            int  countCheck   = 0;
            long tranNumber   = commonGatewayObj.GetMaxNo(accountSchema + ".GL_BASICINFO", "TRAN_ID");
            long contrlNumber = commonGatewayObj.GetMaxNo(accountSchema + ".GL_BASICINFO", "TO_NUMBER(CTRLNO)") - 1;

            string acc_op_id       = unitRepBLObj.getAcc_OP_ID(fundNameDropDownList.SelectedValue.ToString());
            long   acc_terminal_no = unitRepBLObj.getAcc_terminal_no(fundNameDropDownList.SelectedValue.ToString());

            int    faceValue           = unitRepBLObj.getUnitFaceValue(fundNameDropDownList.SelectedValue.ToString());
            string bankPaymentCode     = unitRepBLObj.getUnitBankPaymentCode(fundNameDropDownList.SelectedValue.ToString());
            string getUnitFundBankCode = unitRepBLObj.getUnitFundBankCode(fundNameDropDownList.SelectedValue.ToString());
            string shareCapitalCode    = "101010000";
            string premiumReserveCode  = "101020000";
            string premiumIncomeCode   = "302010000";


            Hashtable htInsert = new Hashtable();
            Hashtable htUpdate = new Hashtable();
            commonGatewayObj.BeginTransaction();
            DataTable dtFundYearEndInfo = commonGatewayObj.Select("SELECT * FROM FUND_INFO WHERE FUND_CD='" + fundNameDropDownList.SelectedValue.ToString() + "'");
            int       year          = Convert.ToDateTime(TranDateTextBox.Text.ToString()).Year;
            int       month         = Convert.ToDateTime(TranDateTextBox.Text.ToString()).Month;
            string    yearStartDate = dtFundYearEndInfo.Rows[0]["YEAR_START_MONTH"].ToString();
            string    yearEndDate   = dtFundYearEndInfo.Rows[0]["YEAR_END_MONTH"].ToString();
            if (yearStartDate == "01-JUL")
            {
                if (month < 6)
                {
                    yearEndDate = yearEndDate + "-" + year.ToString();
                    year--;
                    yearStartDate = yearStartDate + "-" + year.ToString();
                }
                else
                {
                    yearStartDate = yearStartDate + "-" + year.ToString();
                    year++;
                    yearEndDate = yearEndDate + "-" + year.ToString();
                }
            }
            else
            {
                yearStartDate = yearStartDate + "-" + year.ToString();
                yearEndDate   = yearEndDate + "-" + year.ToString();
            }
            if (unitRepBLObj.IsDuplicateAccVoucherNo(accountSchema, VoucherNoTexBox.Text.Trim(), "2", yearStartDate, yearEndDate))
            {
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert('Save Failed Duplicate Payment Voucher Number');", true);
            }
            else
            {
                decimal unitSaleQtyCash        = 0;
                decimal unitSaleTotalValueCash = 0;
                string  moneyReceiptID         = "";

                foreach (GridViewRow Drv in SaleListGridView.Rows)
                {
                    decimal unitFaceValue          = Convert.ToDecimal(faceValue);
                    decimal unitSaleQty            = Convert.ToDecimal(Drv.Cells[5].Text.ToString());
                    decimal unitSaleRate           = Convert.ToDecimal(Drv.Cells[6].Text.ToString());
                    decimal unitSaleTotalValue     = Convert.ToDecimal(Drv.Cells[7].Text.ToString());
                    decimal unitRateDiffernceValue = Convert.ToDecimal(Drv.Cells[10].Text.ToString());
                    decimal totalBankPayment       = Convert.ToDecimal(unitSaleRate * unitSaleQty);
                    decimal totalShareCapital      = Convert.ToDecimal(unitFaceValue * unitSaleQty);
                    decimal totalPremiumIncome     = Convert.ToDecimal(unitRateDiffernceValue * unitSaleQty);
                    decimal totalPremiumReserve    = (totalShareCapital + totalPremiumIncome) - totalBankPayment;


                    if (Drv.Cells[11].Text.ToString().ToUpper() == "CASH")
                    {
                        unitSaleQtyCash        = unitSaleQtyCash + Convert.ToDecimal(Drv.Cells[5].Text.ToString());
                        unitSaleTotalValueCash = unitSaleTotalValueCash + Convert.ToDecimal(Drv.Cells[7].Text.ToString());
                        if (moneyReceiptID == "")
                        {
                            moneyReceiptID = moneyReceiptID + Drv.Cells[0].Text.ToString();
                        }
                        else
                        {
                            moneyReceiptID = moneyReceiptID + "," + Drv.Cells[0].Text.ToString();
                        }
                    }
                    else
                    {
                        htUpdate = new Hashtable();
                        htUpdate.Add("ACC_VOUCHER_ENTRY_BY", userObj.UserID.ToString());
                        htUpdate.Add("ACC_VOUCHER_ENTRY_DATE", TranDateTextBox.Text.Trim());
                        htUpdate.Add("ACC_VOUCHER_NO", VoucherNoTexBox.Text.Trim().ToString());
                        commonGatewayObj.Update(htUpdate, "MONEY_RECEIPT ", "ID=" + Convert.ToInt64(Drv.Cells[0].Text.ToString()));

                        //Bank Payment
                        contrlNumber++;
                        htInsert = new Hashtable();
                        htInsert.Add("TRAN_ID", tranNumber + 1);
                        htInsert.Add("ACCCODE", bankPaymentCode);
                        htInsert.Add("BANKACNO", bankPaymentCode);
                        htInsert.Add("TRAN_TIME", DateTime.Now.ToShortTimeString());
                        htInsert.Add("TRAN_DATE", TranDateTextBox.Text.Trim());
                        htInsert.Add("REMARKS", unitSaleQty.ToString() + " Unit sold @tk." + unitSaleRate.ToString() + " per unit ");
                        htInsert.Add("TRAN_TYPE", "D");
                        htInsert.Add("VOUCHER_NO", VoucherNoTexBox.Text.Trim().ToString());
                        htInsert.Add("TOTAL_AMNT", totalBankPayment);
                        htInsert.Add("CTRLNO", contrlNumber);
                        htInsert.Add("OP_ID", userObj.UserID.ToString());
                        htInsert.Add("VOUCHER_TYPE", "2");
                        if (Drv.Cells[11].Text.ToString().ToUpper() == "BOTH")
                        {
                            htInsert.Add("CHEQUENO", Drv.Cells[8].Text.Trim().ToString() + " ,CASH");
                            htInsert.Add("CHEQUE_DATE", Drv.Cells[9].Text.Trim().ToString());
                        }
                        else if (Drv.Cells[11].Text.ToString().ToUpper() == "MULT")
                        {
                        }
                        else
                        {
                            htInsert.Add("CHEQUENO", Drv.Cells[8].Text.Trim().ToString());
                            htInsert.Add("CHEQUE_DATE", Drv.Cells[9].Text.Trim().ToString());
                        }
                        htInsert.Add("TERMINAL_NO", acc_terminal_no);
                        htInsert.Add("RECENT", "y");
                        htInsert.Add("LATESTDEL", "m");
                        htInsert.Add("ISOUT", "N");
                        htInsert.Add("ISREV", "N");
                        htInsert.Add("OLDDATA", "N");
                        commonGatewayObj.Insert(htInsert, accountSchema + ".GL_TRAN");
                        //ShareCapital
                        contrlNumber++;
                        htInsert = new Hashtable();
                        htInsert.Add("TRAN_ID", tranNumber + 1);
                        htInsert.Add("ACCCODE", shareCapitalCode);
                        htInsert.Add("BANKACNO_CONTRA", shareCapitalCode);
                        htInsert.Add("TRAN_TIME", DateTime.Now.ToShortTimeString());
                        htInsert.Add("TRAN_DATE", TranDateTextBox.Text.Trim());
                        htInsert.Add("REMARKS", unitSaleQty.ToString() + " Unit sold @tk." + unitSaleRate.ToString() + " per unit ");
                        htInsert.Add("TRAN_TYPE", "C");
                        htInsert.Add("VOUCHER_NO", VoucherNoTexBox.Text.Trim().ToString());
                        htInsert.Add("TOTAL_AMNT", totalShareCapital);
                        htInsert.Add("CTRLNO", contrlNumber);
                        htInsert.Add("OP_ID", userObj.UserID.ToString());
                        htInsert.Add("VOUCHER_TYPE", "2");
                        htInsert.Add("TERMINAL_NO", acc_terminal_no);
                        htInsert.Add("RECENT", "y");
                        htInsert.Add("LATESTDEL", "m");
                        htInsert.Add("ISOUT", "N");
                        htInsert.Add("ISREV", "N");
                        htInsert.Add("OLDDATA", "N");
                        commonGatewayObj.Insert(htInsert, accountSchema + ".GL_TRAN");

                        //Premimum Income
                        contrlNumber++;
                        htInsert = new Hashtable();
                        htInsert.Add("TRAN_ID", tranNumber + 1);
                        htInsert.Add("ACCCODE", premiumIncomeCode);
                        htInsert.Add("BANKACNO_CONTRA", premiumIncomeCode);
                        htInsert.Add("TRAN_TIME", DateTime.Now.ToShortTimeString());
                        htInsert.Add("TRAN_DATE", TranDateTextBox.Text.Trim());
                        htInsert.Add("REMARKS", unitSaleQty.ToString() + " Unit sold @tk." + unitSaleRate.ToString() + " per unit ");
                        htInsert.Add("TRAN_TYPE", "C");
                        htInsert.Add("VOUCHER_NO", VoucherNoTexBox.Text.Trim().ToString());
                        htInsert.Add("TOTAL_AMNT", totalPremiumIncome);
                        htInsert.Add("CTRLNO", contrlNumber);
                        htInsert.Add("OP_ID", userObj.UserID.ToString());
                        htInsert.Add("VOUCHER_TYPE", "2");
                        htInsert.Add("TERMINAL_NO", acc_terminal_no);
                        htInsert.Add("RECENT", "y");
                        htInsert.Add("LATESTDEL", "m");
                        htInsert.Add("ISOUT", "N");
                        htInsert.Add("ISREV", "N");
                        htInsert.Add("OLDDATA", "N");
                        commonGatewayObj.Insert(htInsert, accountSchema + ".GL_TRAN");

                        //premium reserve

                        if (totalPremiumReserve > 0)
                        {
                            contrlNumber++;
                            htInsert = new Hashtable();
                            htInsert.Add("TRAN_ID", tranNumber + 1);
                            htInsert.Add("ACCCODE", premiumReserveCode);
                            htInsert.Add("BANKACNO", premiumReserveCode);
                            htInsert.Add("TRAN_TIME", DateTime.Now.ToShortTimeString());
                            htInsert.Add("TRAN_DATE", TranDateTextBox.Text.Trim());
                            htInsert.Add("REMARKS", unitSaleQty.ToString() + " unit sold @tk." + unitSaleRate.ToString() + " per unit ");
                            htInsert.Add("TRAN_TYPE", "D");
                            htInsert.Add("VOUCHER_NO", VoucherNoTexBox.Text.Trim().ToString());
                            htInsert.Add("TOTAL_AMNT", totalPremiumReserve);
                            htInsert.Add("CTRLNO", contrlNumber);
                            htInsert.Add("OP_ID", userObj.UserID.ToString());
                            htInsert.Add("VOUCHER_TYPE", "2");
                            htInsert.Add("TERMINAL_NO", acc_terminal_no);
                            htInsert.Add("RECENT", "y");
                            htInsert.Add("LATESTDEL", "m");
                            htInsert.Add("ISOUT", "N");
                            htInsert.Add("ISREV", "N");
                            htInsert.Add("OLDDATA", "N");
                            commonGatewayObj.Insert(htInsert, accountSchema + ".GL_TRAN");
                        }
                        else if (totalPremiumReserve < 0)
                        {
                            contrlNumber++;
                            htInsert = new Hashtable();
                            htInsert.Add("TRAN_ID", tranNumber + 1);
                            htInsert.Add("ACCCODE", premiumReserveCode);
                            htInsert.Add("BANKACNO_CONTRA", premiumReserveCode);
                            htInsert.Add("TRAN_TIME", DateTime.Now.ToShortTimeString());
                            htInsert.Add("TRAN_DATE", TranDateTextBox.Text.Trim());
                            htInsert.Add("REMARKS", unitSaleQty.ToString() + " unit sold @tk." + unitSaleRate.ToString() + " per unit ");
                            htInsert.Add("TRAN_TYPE", "C");
                            htInsert.Add("VOUCHER_NO", VoucherNoTexBox.Text.Trim().ToString());
                            htInsert.Add("TOTAL_AMNT", totalPremiumReserve * (-1));
                            htInsert.Add("CTRLNO", contrlNumber);
                            htInsert.Add("OP_ID", userObj.UserID.ToString());
                            htInsert.Add("VOUCHER_TYPE", "2");
                            htInsert.Add("TERMINAL_NO", acc_terminal_no);
                            htInsert.Add("RECENT", "y");
                            htInsert.Add("LATESTDEL", "m");
                            htInsert.Add("ISOUT", "N");
                            htInsert.Add("ISREV", "N");
                            htInsert.Add("OLDDATA", "N");
                            commonGatewayObj.Insert(htInsert, accountSchema + ".GL_TRAN");
                        }
                    }

                    countCheck++;

                    if (countCheck == SaleListGridView.Rows.Count && unitSaleQtyCash > 0 && unitSaleTotalValueCash > 0)
                    {
                        decimal totalBankPaymentCash    = Convert.ToDecimal(unitSaleRate * unitSaleQtyCash);
                        decimal totalShareCapitalCash   = Convert.ToDecimal(unitFaceValue * unitSaleQtyCash);
                        decimal totalPremiumIncomeCash  = Convert.ToDecimal(unitRateDiffernceValue * unitSaleQtyCash);
                        decimal totalPremiumReserveCash = (totalShareCapitalCash + totalPremiumIncomeCash) - totalBankPaymentCash;
                        htUpdate = new Hashtable();
                        htUpdate.Add("ACC_VOUCHER_ENTRY_BY", userObj.UserID.ToString());
                        htUpdate.Add("ACC_VOUCHER_ENTRY_DATE", TranDateTextBox.Text.Trim());
                        htUpdate.Add("ACC_VOUCHER_NO", VoucherNoTexBox.Text.Trim().ToString());
                        commonGatewayObj.Update(htUpdate, "MONEY_RECEIPT ", "ID IN (" + moneyReceiptID + ")");

                        //Bank Payment
                        contrlNumber++;
                        htInsert = new Hashtable();
                        htInsert.Add("TRAN_ID", tranNumber + 1);
                        htInsert.Add("ACCCODE", bankPaymentCode);
                        htInsert.Add("BANKACNO", bankPaymentCode);
                        htInsert.Add("TRAN_TIME", DateTime.Now.ToShortTimeString());
                        htInsert.Add("TRAN_DATE", TranDateTextBox.Text.Trim());
                        htInsert.Add("REMARKS", unitSaleQtyCash.ToString() + " Unit sold @tk." + unitSaleRate.ToString() + " per unit ");
                        htInsert.Add("TRAN_TYPE", "D");
                        htInsert.Add("VOUCHER_NO", VoucherNoTexBox.Text.Trim().ToString());
                        htInsert.Add("TOTAL_AMNT", totalBankPaymentCash);
                        htInsert.Add("CTRLNO", contrlNumber);
                        htInsert.Add("OP_ID", userObj.UserID.ToString());
                        htInsert.Add("VOUCHER_TYPE", "2");
                        htInsert.Add("CHEQUENO", "CASH");
                        htInsert.Add("TERMINAL_NO", acc_terminal_no);
                        htInsert.Add("RECENT", "y");
                        htInsert.Add("LATESTDEL", "m");
                        htInsert.Add("ISOUT", "N");
                        htInsert.Add("ISREV", "N");
                        htInsert.Add("OLDDATA", "N");
                        commonGatewayObj.Insert(htInsert, accountSchema + ".GL_TRAN");
                        //ShareCapital
                        contrlNumber++;
                        htInsert = new Hashtable();
                        htInsert.Add("TRAN_ID", tranNumber + 1);
                        htInsert.Add("ACCCODE", shareCapitalCode);
                        htInsert.Add("BANKACNO_CONTRA", shareCapitalCode);
                        htInsert.Add("TRAN_TIME", DateTime.Now.ToShortTimeString());
                        htInsert.Add("TRAN_DATE", TranDateTextBox.Text.Trim());
                        htInsert.Add("REMARKS", unitSaleQtyCash.ToString() + " Unit sold @tk." + unitSaleRate.ToString() + " per unit ");
                        htInsert.Add("TRAN_TYPE", "C");
                        htInsert.Add("VOUCHER_NO", VoucherNoTexBox.Text.Trim().ToString());
                        htInsert.Add("TOTAL_AMNT", totalShareCapitalCash);
                        htInsert.Add("CTRLNO", contrlNumber);
                        htInsert.Add("OP_ID", userObj.UserID.ToString());
                        htInsert.Add("VOUCHER_TYPE", "2");
                        htInsert.Add("TERMINAL_NO", acc_terminal_no);
                        htInsert.Add("RECENT", "y");
                        htInsert.Add("LATESTDEL", "m");
                        htInsert.Add("ISOUT", "N");
                        htInsert.Add("ISREV", "N");
                        htInsert.Add("OLDDATA", "N");
                        commonGatewayObj.Insert(htInsert, accountSchema + ".GL_TRAN");

                        //Premimum Income
                        contrlNumber++;
                        htInsert = new Hashtable();
                        htInsert.Add("TRAN_ID", tranNumber + 1);
                        htInsert.Add("ACCCODE", premiumIncomeCode);
                        htInsert.Add("BANKACNO_CONTRA", premiumIncomeCode);
                        htInsert.Add("TRAN_TIME", DateTime.Now.ToShortTimeString());
                        htInsert.Add("TRAN_DATE", TranDateTextBox.Text.Trim());
                        htInsert.Add("REMARKS", unitSaleQtyCash.ToString() + " Unit sold @tk." + unitSaleRate.ToString() + " per unit ");
                        htInsert.Add("TRAN_TYPE", "C");
                        htInsert.Add("VOUCHER_NO", VoucherNoTexBox.Text.Trim().ToString());
                        htInsert.Add("TOTAL_AMNT", totalPremiumIncomeCash);
                        htInsert.Add("CTRLNO", contrlNumber);
                        htInsert.Add("OP_ID", userObj.UserID.ToString());
                        htInsert.Add("VOUCHER_TYPE", "2");
                        htInsert.Add("TERMINAL_NO", acc_terminal_no);
                        htInsert.Add("RECENT", "y");
                        htInsert.Add("LATESTDEL", "m");
                        htInsert.Add("ISOUT", "N");
                        htInsert.Add("ISREV", "N");
                        htInsert.Add("OLDDATA", "N");
                        commonGatewayObj.Insert(htInsert, accountSchema + ".GL_TRAN");

                        //premium reserve

                        if (totalPremiumReserve > 0)
                        {
                            contrlNumber++;
                            htInsert = new Hashtable();
                            htInsert.Add("TRAN_ID", tranNumber + 1);
                            htInsert.Add("ACCCODE", premiumReserveCode);
                            htInsert.Add("BANKACNO", premiumReserveCode);
                            htInsert.Add("TRAN_TIME", DateTime.Now.ToShortTimeString());
                            htInsert.Add("TRAN_DATE", TranDateTextBox.Text.Trim());
                            htInsert.Add("REMARKS", unitSaleQtyCash.ToString() + " unit sold @tk." + unitSaleRate.ToString() + " per unit ");
                            htInsert.Add("TRAN_TYPE", "D");
                            htInsert.Add("VOUCHER_NO", VoucherNoTexBox.Text.Trim().ToString());
                            htInsert.Add("TOTAL_AMNT", totalPremiumReserveCash);
                            htInsert.Add("CTRLNO", contrlNumber);
                            htInsert.Add("OP_ID", userObj.UserID.ToString());
                            htInsert.Add("VOUCHER_TYPE", "2");
                            htInsert.Add("TERMINAL_NO", acc_terminal_no);
                            htInsert.Add("RECENT", "y");
                            htInsert.Add("LATESTDEL", "m");
                            htInsert.Add("ISOUT", "N");
                            htInsert.Add("ISREV", "N");
                            htInsert.Add("OLDDATA", "N");
                            commonGatewayObj.Insert(htInsert, accountSchema + ".GL_TRAN");
                        }
                        else if (totalPremiumReserve < 0)
                        {
                            contrlNumber++;
                            htInsert = new Hashtable();
                            htInsert.Add("TRAN_ID", tranNumber + 1);
                            htInsert.Add("ACCCODE", premiumReserveCode);
                            htInsert.Add("BANKACNO_CONTRA", premiumReserveCode);
                            htInsert.Add("TRAN_TIME", DateTime.Now.ToShortTimeString());
                            htInsert.Add("TRAN_DATE", TranDateTextBox.Text.Trim());
                            htInsert.Add("REMARKS", unitSaleQtyCash.ToString() + " unit sold @tk." + unitSaleRate.ToString() + " per unit ");
                            htInsert.Add("TRAN_TYPE", "C");
                            htInsert.Add("VOUCHER_NO", VoucherNoTexBox.Text.Trim().ToString());
                            htInsert.Add("TOTAL_AMNT", totalPremiumReserveCash * (-1));
                            htInsert.Add("CTRLNO", contrlNumber);
                            htInsert.Add("OP_ID", userObj.UserID.ToString());
                            htInsert.Add("VOUCHER_TYPE", "2");
                            htInsert.Add("TERMINAL_NO", acc_terminal_no);
                            htInsert.Add("RECENT", "y");
                            htInsert.Add("LATESTDEL", "m");
                            htInsert.Add("ISOUT", "N");
                            htInsert.Add("ISREV", "N");
                            htInsert.Add("OLDDATA", "N");
                            commonGatewayObj.Insert(htInsert, accountSchema + ".GL_TRAN");
                        }
                    }
                }


                contrlNumber++;
                tranNumber++;
                commonGatewayObj.ExecuteNonQuery(" UPDATE " + accountSchema + ".GL_BASICINFO SET TRAN_ID=" + tranNumber + " , CTRLNO='" + contrlNumber + "' WHERE 1=1");
                commonGatewayObj.CommitTransaction();
            }
        }
        catch (Exception ex)
        {
            commonGatewayObj.RollbackTransaction();
            throw ex;
        }
    }
Esempio n. 19
0
    public void Save(DataTable dt)
    {
        string strBalanceDate, strLastBalDate, strLastUpadateDate, strLastUpadatePlusOneDate, strUpdateFundTransHB, strDelFromFundFolioHB, strMarketPriceDate, temp;

        DateTime?     dtimeBalanceDate, dtimeLastBalDate, dtimeLastUpadateDate, dtimeLastUpadatePlusOneDate, dtMarketPriceDate;
        DataTable     dtFromFundTransHB = new DataTable();
        DataTable     dtFromFundFolioHB = new DataTable();
        CommonGateway commonGatewayObj  = new CommonGateway();
        DataTable     dtSource          = new DataTable();
        DataTable     dtSource2         = new DataTable();

        DataTable tblAllfundInfo = dt;


        List <string> fundBalanceDate = (from row in tblAllfundInfo.AsEnumerable()
                                         select row["LastUpadateDate"].ToString()).ToList();
        string lastupdateddate = "01-JUL-2002";

        if (fundBalanceDate.Contains(lastupdateddate.ToString()))
        {
            ClientScript.RegisterStartupScript(this.GetType(), "Popup", "alert('Process will be started from July 2002.');", true);
        }


        for (int i = 0; i < tblAllfundInfo.Rows.Count; i++)
        {
            if (!string.IsNullOrEmpty(tblAllfundInfo.Rows[i]["BalanceDate"].ToString()))
            {
                dtimeBalanceDate = Convert.ToDateTime(tblAllfundInfo.Rows[i]["BalanceDate"].ToString());

                strBalanceDate = dtimeBalanceDate.Value.ToString("dd-MMM-yyyy");
            }
            else
            {
                dtimeBalanceDate = null;
                strBalanceDate   = "";
            }

            if (!string.IsNullOrEmpty(tblAllfundInfo.Rows[i]["LastBalDate"].ToString()))
            {
                dtimeLastBalDate = Convert.ToDateTime(tblAllfundInfo.Rows[i]["LastBalDate"].ToString());
                strLastBalDate   = dtimeLastBalDate.Value.ToString("dd-MMM-yyyy");
            }
            else
            {
                dtimeLastBalDate = null;
                strLastBalDate   = "";
            }
            if (!string.IsNullOrEmpty(tblAllfundInfo.Rows[i]["LastUpadateDate"].ToString()))
            {
                dtimeLastUpadateDate        = Convert.ToDateTime(tblAllfundInfo.Rows[i]["LastUpadateDate"].ToString());
                strLastUpadateDate          = dtimeLastUpadateDate.Value.ToString("dd-MMM-yyyy");
                dtimeLastUpadatePlusOneDate = dtimeLastUpadateDate.Value.AddDays(1);
                strLastUpadatePlusOneDate   = dtimeLastUpadatePlusOneDate.Value.ToString("dd-MMM-yyyy");
            }
            else
            {
                dtimeLastUpadateDate        = null;
                strLastUpadateDate          = "";
                dtimeLastUpadatePlusOneDate = null;
                strLastUpadatePlusOneDate   = "";
            }

            if (!string.IsNullOrEmpty(tblAllfundInfo.Rows[i]["MarketPriceDate"].ToString()))
            {
                dtMarketPriceDate  = Convert.ToDateTime(tblAllfundInfo.Rows[i]["MarketPriceDate"].ToString());
                strMarketPriceDate = dtMarketPriceDate.Value.ToString("dd-MMM-yyyy");
            }
            else
            {
                dtMarketPriceDate  = null;
                strMarketPriceDate = "";
            }

            if (dtimeBalanceDate > dtimeLastBalDate)
            {
                temp = adv_proc1(strLastUpadatePlusOneDate, strBalanceDate, tblAllfundInfo.Rows[i]["F_CD"].ToString());
            }
            else
            {
                commonGatewayObj.BeginTransaction();
                strDelFromFundFolioHB = "delete from fund_folio_hb where f_cd =" + tblAllfundInfo.Rows[i]["F_CD"].ToString();
                int noDelRowsFromFundFolioHB = commonGatewayObj.ExecuteNonQuery(strDelFromFundFolioHB);

                strUpdateFundTransHB = "update fund_trans_hb set cost_rate = null,crt_aft_com = null where f_cd =" + tblAllfundInfo.Rows[i]["F_CD"].ToString();
                int noUpdRowsFundTransHB = commonGatewayObj.ExecuteNonQuery(strUpdateFundTransHB);
                commonGatewayObj.CommitTransaction();

                temp = adv_proc1(strLastUpadatePlusOneDate, strBalanceDate, tblAllfundInfo.Rows[i]["F_CD"].ToString());
            }


            string strCompnayTransdate = "select a.comp_cd, max(a.tran_date) tran_date from market_price a, fund_folio_hb b where a.comp_cd = b.comp_cd and b.f_cd =" + tblAllfundInfo.Rows[i]["F_CD"].ToString() + " and a.tran_date <= '" + strBalanceDate + "' group by a.comp_cd order by a.comp_cd";

            dtSource = commonGatewayObj.Select(strCompnayTransdate);

            List <CompanayTransdate>  lstCompnayTransdate = new List <CompanayTransdate>();
            List <CompanyAvarageRate> lstCompnayAvgrate   = new List <CompanyAvarageRate>();
            lstCompnayTransdate = (from DataRow dr in dtSource.Rows
                                   select new CompanayTransdate()
            {
                COMP_CD = dr["COMP_CD"].ToString(),
                TRAN_DATE = dr["TRAN_DATE"].ToString()
            }).ToList();

            string dltQuery     = "delete from mprice_temp where f_cd=" + tblAllfundInfo.Rows[i]["F_CD"].ToString();
            int    dltNumOfRows = commonGatewayObj.ExecuteNonQuery(dltQuery);

            foreach (CompanayTransdate comtransdate in lstCompnayTransdate)
            {
                string strInsQuery = "select " + tblAllfundInfo.Rows[i]["F_CD"].ToString() + " as FundId, comp_cd, avg_rt from  market_price where comp_cd = " + comtransdate.COMP_CD + " and tran_date = '" + Convert.ToDateTime(comtransdate.TRAN_DATE).ToString("dd-MMM-yyyy") + "'";

                dtSource2 = commonGatewayObj.Select(strInsQuery);

                lstCompnayAvgrate = (from DataRow dr in dtSource2.Rows
                                     select new CompanyAvarageRate()
                {
                    FUNDID = dr["FUNDID"].ToString(),
                    COMP_CD = dr["COMP_CD"].ToString(),
                    AVG_RT = dr["AVG_RT"].ToString()
                }).ToList();


                foreach (CompanyAvarageRate comAvgrate in lstCompnayAvgrate)
                {
                    string strQueryInsMprice_Temp = "insert into mprice_temp(f_cd, comp_cd, avg_rt) values ('" + comAvgrate.FUNDID + "','" + comAvgrate.COMP_CD + "','" + comAvgrate.AVG_RT + "')";
                    int    NumOfRows = commonGatewayObj.ExecuteNonQuery(strQueryInsMprice_Temp);
                }
            }
            string   LoginID = Session["UserID"].ToString();
            DateTime dtimeCurrentDateTimeForLog = DateTime.Now;
            string   strCurrentDateTimeForLog   = dtimeCurrentDateTimeForLog.ToString("dd-MMM-yyyy HH:mm:ss tt", CultureInfo.InvariantCulture);

            string strupdateQueryfund_control  = "update fund_control set op_name='" + LoginID + "',upd_date_time='" + strCurrentDateTimeForLog + "',bal_dt='" + strBalanceDate + "',mprice_dt='" + strMarketPriceDate + "' where f_cd =" + tblAllfundInfo.Rows[i]["F_CD"].ToString() + "";
            int    updatefund_controlNumOfRows = commonGatewayObj.ExecuteNonQuery(strupdateQueryfund_control);


            if (temp.Trim() == "Processing Completed" || temp.Trim() == "")
            {
                lblProcessing.Text = "Processing completed!!!!";
                // ClearFields();
            }
            else
            {
                lblProcessing.Text = "No data found!!!!";
                //  ClearFields();
            }
        }
    }
    protected void PrintSaveButton_Click(object sender, EventArgs e)
    {
        UnitHolderRegistration regObj = new UnitHolderRegistration();

        long      money_Receipt_ID     = 0;
        Hashtable htInsertMoneyReceipt = new Hashtable();
        Hashtable htUpdateMoneyReceipt = new Hashtable();

        try
        {
            regObj.FundCode   = fundCodeDDL.SelectedValue.ToString();
            regObj.BranchCode = branchCodeDDL.SelectedValue.ToString();


            commonGatewayObj.BeginTransaction();
            money_Receipt_ID = commonGatewayObj.GetMaxNo("MONEY_RECEIPT", "ID") + 1;

            htUpdateMoneyReceipt.Add("VALID", "N");
            htUpdateMoneyReceipt.Add("RECEIPT_EDIT_TYPE", "E");
            htUpdateMoneyReceipt.Add("RECEIPT_EDIT_BY", userObj.UserID.ToString());
            htUpdateMoneyReceipt.Add("RECEIPT_EDIT_DATE", DateTime.Today.ToString("dd-MMM-yyyy"));

            commonGatewayObj.Update(htUpdateMoneyReceipt, "MONEY_RECEIPT", "ID=" + moneyReceipDropDownList.SelectedValue.ToString());


            htInsertMoneyReceipt.Add("ID", money_Receipt_ID);
            htInsertMoneyReceipt.Add("RECEIPT_NO", moneyReceipDropDownList.SelectedItem.Text);
            htInsertMoneyReceipt.Add("RECEIPT_TYPE", "REP");
            htInsertMoneyReceipt.Add("RECEIPT_DATE", ReceiptDateTextBox.Text.Trim());
            htInsertMoneyReceipt.Add("REG_BK", fundCodeDDL.SelectedValue.ToString());
            htInsertMoneyReceipt.Add("REG_BR", branchCodeDDL.SelectedValue.ToString());
            htInsertMoneyReceipt.Add("REG_NO", regNoTextBox.Text.Trim());

            if (holderBOTextBox.Text.Trim() != "")
            {
                htInsertMoneyReceipt.Add("BO", holderBOTextBox.Text.Trim());
            }
            htInsertMoneyReceipt.Add("HNAME", NameTextBox.Text.Trim());
            htInsertMoneyReceipt.Add("ADDRESS", addressTextBox.Text.Trim());
            htInsertMoneyReceipt.Add("UNIT_QTY", QtyTextBox.Text.Trim());
            htInsertMoneyReceipt.Add("RATE", RateTextBox.Text.Trim());
            htInsertMoneyReceipt.Add("SL_TR_RN_NO", SaleTRRNNoTextBox.Text.Trim().ToUpper());
            if (EFTRadioButton.Checked)
            {
                htInsertMoneyReceipt.Add("REP_PAY_TYPE", "EFT");
            }
            else
            {
                htInsertMoneyReceipt.Add("REP_PAY_TYPE", "CHQ");
            }
            htInsertMoneyReceipt.Add("REP_PAY_DATE", PayDateTextBox.Text.Trim());
            htInsertMoneyReceipt.Add("RECEIPT_ENTRY_BY", userObj.UserID.ToString());
            htInsertMoneyReceipt.Add("RECEIPT_ENTRY_DATE", DateTime.Today.ToString("dd-MMM-yyyy"));

            commonGatewayObj.Insert(htInsertMoneyReceipt, "MONEY_RECEIPT");
            commonGatewayObj.CommitTransaction();
            ClearText();
            Session["MONEY_RECEIPT_ID"]   = money_Receipt_ID.ToString();
            Session["MONEY_RECEIPT_TYPE"] = "REP";
            ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "window.open('ReportViewer/UnitReportMoneyReceiptReportViewer.aspx');", true);
        }

        catch (Exception ex)
        {
            commonGatewayObj.RollbackTransaction();
            Session["MONEY_RECEIPT_ID"]   = null;
            Session["MONEY_RECEIPT_TYPE"] = null;
            ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert('Save and print Failed');", true);
        }
    }
Esempio n. 21
0
    protected void PrintSaveButton_Click(object sender, EventArgs e)
    {
        UnitHolderRegistration regObj = new UnitHolderRegistration();

        long      money_Receipt_ID     = 0;
        Hashtable htInsertMoneyReceipt = new Hashtable();
        Hashtable htUpdateMoneyReceipt = new Hashtable();

        try
        {
            regObj.FundCode   = fundCodeDDL.SelectedValue.ToString();
            regObj.BranchCode = branchCodeDDL.SelectedValue.ToString();

            money_Receipt_ID = commonGatewayObj.GetMaxNo("MONEY_RECEIPT", "ID") + 1;
            commonGatewayObj.BeginTransaction();

            htUpdateMoneyReceipt.Add("VALID", "N");
            htUpdateMoneyReceipt.Add("RECEIPT_EDIT_TYPE", "E");
            htUpdateMoneyReceipt.Add("RECEIPT_EDIT_BY", userObj.UserID.ToString());
            htUpdateMoneyReceipt.Add("RECEIPT_EDIT_DATE", DateTime.Today.ToString("dd-MMM-yyyy"));

            commonGatewayObj.Update(htUpdateMoneyReceipt, "MONEY_RECEIPT", "ID=" + moneyReceipDropDownList.SelectedValue.ToString());


            htInsertMoneyReceipt.Add("ID", money_Receipt_ID);
            htInsertMoneyReceipt.Add("RECEIPT_NO", moneyReceipDropDownList.SelectedItem.Text);
            htInsertMoneyReceipt.Add("RECEIPT_TYPE", "SL");
            htInsertMoneyReceipt.Add("RECEIPT_DATE", ReceiptDateTextBox.Text.Trim());
            htInsertMoneyReceipt.Add("REG_BK", fundCodeDDL.SelectedValue.ToString());
            htInsertMoneyReceipt.Add("REG_BR", branchCodeDDL.SelectedValue.ToString());
            if (regNoTextBox.Text.Trim() != "")
            {
                htInsertMoneyReceipt.Add("REG_NO", regNoTextBox.Text.Trim());
            }
            if (holderBOTextBox.Text.Trim() != "")
            {
                htInsertMoneyReceipt.Add("BO", holderBOTextBox.Text.Trim());
            }
            if (NameTextBox.Text.Trim() != "")
            {
                htInsertMoneyReceipt.Add("HNAME", NameTextBox.Text.Trim());
            }
            htInsertMoneyReceipt.Add("ADDRESS", addressTextBox.Text.Trim());
            htInsertMoneyReceipt.Add("UNIT_QTY", QtyTextBox.Text.Trim());
            htInsertMoneyReceipt.Add("RATE", RateTextBox.Text.Trim());



            if (ChqRadioButton.Checked)
            {
                htInsertMoneyReceipt.Add("PAY_TYPE", "CHQ");
                htInsertMoneyReceipt.Add("CHQ_TYPE", ChequeTypeDropDownList.SelectedValue.ToString());
            }
            else if (CashRadioButton.Checked)
            {
                htInsertMoneyReceipt.Add("PAY_TYPE", "CASH");
            }
            else if (BothRadioButton.Checked)
            {
                htInsertMoneyReceipt.Add("PAY_TYPE", "BOTH");
                htInsertMoneyReceipt.Add("CHQ_TYPE", ChequeTypeDropDownList.SelectedValue.ToString());
            }
            else if (MultiRadioButton.Checked)
            {
                htInsertMoneyReceipt.Add("PAY_TYPE", "MULT");
            }
            if (CHQDDPONOTextBox.Text.Trim() != "")
            {
                htInsertMoneyReceipt.Add("CHQ_DD_NO", CHQDDPONOTextBox.Text.Trim());
            }
            if (chequeDateTextBox.Text.Trim() != "")
            {
                htInsertMoneyReceipt.Add("CHQ_DD_DATE", chequeDateTextBox.Text.Trim());
            }
            if (RoutingNoTextBox.Text.Trim() != "")
            {
                htInsertMoneyReceipt.Add("ROUTING_NO", RoutingNoTextBox.Text.Trim());
            }
            if (BankInfoTextBox.Text.Trim() != "")
            {
                htInsertMoneyReceipt.Add("BANK_INFO", BankInfoTextBox.Text.Trim());
            }
            if (CashAmountTextBox.Text.Trim() != "")
            {
                htInsertMoneyReceipt.Add("CASH_AMT", CashAmountTextBox.Text.Trim());
            }
            if (MultiplePayTypeTextBox.Text.Trim() != "")
            {
                htInsertMoneyReceipt.Add("MULTI_PAY_REMARKS", MultiplePayTypeTextBox.Text.Trim());
            }
            if (sellingAgentCodeTextBox.Text != "")
            {
                if (sellingAgentCodeTextBox.Text != "0")
                {
                    if (sellingAgentCodeTextBox.Text == agentNameDDL.SelectedValue.ToString())
                    {
                        htInsertMoneyReceipt.Add("SELLING_AGENT_ID", agentNameDDL.SelectedValue.ToString());
                        htInsertMoneyReceipt.Add("SELLING_AGENT_NAME", agentNameDDL.SelectedItem.Text.ToString());
                    }
                }
            }

            htInsertMoneyReceipt.Add("RECEIPT_ENTRY_BY", userObj.UserID.ToString());
            htInsertMoneyReceipt.Add("RECEIPT_ENTRY_DATE", DateTime.Today.ToString("dd-MMM-yyyy"));

            commonGatewayObj.Insert(htInsertMoneyReceipt, "MONEY_RECEIPT");
            commonGatewayObj.CommitTransaction();
            ClearText();
            moneyReceipDropDownList.DataSource     = unitSaleBLObj.dtMoneyRecieptforDDL(" AND REG_BK = '" + regObj.FundCode.ToString().ToUpper() + "' AND REG_BR = '" + regObj.BranchCode.ToString().ToUpper() + "'AND RECEIPT_TYPE = 'SL' AND SL_REP_TR_RN_NO IS NULL AND ACC_VOUCHER_NO IS NULL ORDER BY RECEIPT_NO DESC ");
            moneyReceipDropDownList.DataTextField  = "RECEIPT_NO";
            moneyReceipDropDownList.DataValueField = "ID";
            moneyReceipDropDownList.DataBind();
            Session["MONEY_RECEIPT_ID"]   = money_Receipt_ID.ToString();
            Session["MONEY_RECEIPT_TYPE"] = "SL";
            ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "window.open('ReportViewer/UnitReportMoneyReceiptReportViewer.aspx');", true);
        }

        catch (Exception ex)
        {
            commonGatewayObj.RollbackTransaction();
            Session["MONEY_RECEIPT_ID"]   = null;
            Session["MONEY_RECEIPT_TYPE"] = null;
            ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert('Edit and print Failed');", true);
        }
    }
Esempio n. 22
0
        public void saveTransfer(DataTable dtTransferSaleCert, UnitHolderRegistration regObj, UnitTransfer transferObj, UnitUser unitUserObj)
        {
            try
            {
                commonGatewayObj.BeginTransaction();
                Hashtable htTransferRegInfo = new Hashtable();
                Hashtable htTransCertNoTemp = new Hashtable();
                int       SL_TR_RN          = 0;
                int       CertNo            = 0;
                string    certType          = "";
                string[]  saleNoArray;
                string[]  certArray;
                string    statusFlag   = "T";
                string    Old_SL_TR_RN = "";

                for (int loop = 0; loop < dtTransferSaleCert.Rows.Count; loop++)
                {
                    if (dtTransferSaleCert.Rows[loop]["SL_NO"].ToString().ToUpper().IndexOf('S') >= 0)
                    {
                        htTransferRegInfo = new Hashtable();
                        htTransferRegInfo.Add("CURR_REG_BK", regObj.FundCode.ToString().ToUpper());
                        htTransferRegInfo.Add("CURR_REG_BR", transferObj.TfereeBranchCode.ToString().ToUpper());
                        htTransferRegInfo.Add("CURR_REG_NO", transferObj.TransfereeRegNo.ToString());
                        htTransferRegInfo.Add("STATUS_FLAG", statusFlag.ToUpper().ToString());

                        saleNoArray = dtTransferSaleCert.Rows[loop]["SL_NO"].ToString().Split('S');
                        SL_TR_RN    = Convert.ToInt32(saleNoArray[1].ToString());
                        certArray   = dtTransferSaleCert.Rows[loop]["CERTIFICATE"].ToString().Split('-');
                        CertNo      = Convert.ToInt32(certArray[1].ToString());
                        certType    = certArray[0].ToString().ToUpper();
                        commonGatewayObj.Update(htTransferRegInfo, "SALE_CERT", "REG_NO=" + Convert.ToInt32(regObj.RegNumber) + " AND REG_BK='" + regObj.FundCode.ToString().ToUpper() + "' AND REG_BR='" + regObj.BranchCode.ToString().ToUpper() + "' AND  SL_NO=" + SL_TR_RN + " AND CERT_NO=" + CertNo + " AND CERT_TYPE='" + certType + "'");

                        Old_SL_TR_RN = "S" + SL_TR_RN.ToString();
                    }
                    else if (dtTransferSaleCert.Rows[loop]["SL_NO"].ToString().ToUpper().IndexOf('T') >= 0)
                    {
                        htTransferRegInfo = new Hashtable();
                        htTransferRegInfo.Add("CURR_REG_BK", regObj.FundCode.ToString());
                        htTransferRegInfo.Add("CURR_REG_BR", transferObj.TfereeBranchCode.ToString().ToUpper());
                        htTransferRegInfo.Add("CURR_REG_NO", transferObj.TransfereeRegNo.ToString());
                        htTransferRegInfo.Add("STATUS_FLAG", statusFlag.ToUpper().ToString());

                        saleNoArray = dtTransferSaleCert.Rows[loop]["SL_NO"].ToString().Split('T');
                        SL_TR_RN    = Convert.ToInt32(saleNoArray[1].ToString());
                        certArray   = dtTransferSaleCert.Rows[loop]["CERTIFICATE"].ToString().Split('-');
                        CertNo      = Convert.ToInt32(certArray[1].ToString());
                        certType    = certArray[0].ToString().ToUpper();


                        commonGatewayObj.Update(htTransferRegInfo, "TRANS_CERT", "F_CD='" + regObj.FundCode.ToString().ToUpper() + "' AND TR_NO=" + SL_TR_RN + " AND CERT_NO=" + CertNo + " AND CERT_TYPE='" + certType + "'");
                        commonGatewayObj.Update(htTransferRegInfo, "SALE_CERT", "REG_NO=" + Convert.ToInt32(regObj.RegNumber) + " AND REG_BK='" + regObj.FundCode.ToString().ToUpper() + "' AND REG_BR='" + regObj.BranchCode.ToString().ToUpper() + "' AND CERT_NO=" + CertNo + " AND CERT_TYPE='" + certType + "'");
                        commonGatewayObj.Update(htTransferRegInfo, "RENEWAL_OUT", "REG_NO=" + Convert.ToInt32(regObj.RegNumber) + " AND REG_BK='" + regObj.FundCode.ToString().ToUpper() + "' AND REG_BR='" + regObj.BranchCode.ToString().ToUpper() + "' AND CERT_NO=" + CertNo + " AND CERT_TYPE='" + certType + "'");

                        Old_SL_TR_RN = "T" + SL_TR_RN.ToString();
                    }
                    else if (dtTransferSaleCert.Rows[loop]["SL_NO"].ToString().ToUpper().IndexOf('R') >= 0)
                    {
                        htTransferRegInfo = new Hashtable();
                        htTransferRegInfo.Add("CURR_REG_BK", regObj.FundCode.ToString().ToUpper());
                        htTransferRegInfo.Add("CURR_REG_BR", transferObj.TfereeBranchCode.ToString().ToUpper());
                        htTransferRegInfo.Add("CURR_REG_NO", transferObj.TransfereeRegNo.ToString());
                        htTransferRegInfo.Add("STATUS_FLAG", statusFlag.ToUpper().ToString());

                        saleNoArray = dtTransferSaleCert.Rows[loop]["SL_NO"].ToString().Split('R');
                        SL_TR_RN    = Convert.ToInt32(saleNoArray[1].ToString());
                        certArray   = dtTransferSaleCert.Rows[loop]["CERTIFICATE"].ToString().Split('-');
                        CertNo      = Convert.ToInt32(certArray[1].ToString());
                        certType    = certArray[0].ToString().ToUpper();

                        commonGatewayObj.Update(htTransferRegInfo, "RENEWAL_OUT", "REG_NO=" + Convert.ToInt32(regObj.RegNumber) + " AND REG_BK='" + regObj.FundCode.ToString().ToUpper() + "' AND REG_BR='" + regObj.BranchCode.ToString().ToUpper() + "' AND CERT_NO=" + CertNo + " AND CERT_TYPE='" + certType + "'");

                        Old_SL_TR_RN = "R" + SL_TR_RN.ToString();
                    }


                    htTransferRegInfo = new Hashtable();
                    htTransferRegInfo.Add("F_CD", regObj.FundCode.ToString().ToUpper());
                    htTransferRegInfo.Add("BR_CODE", regObj.FundCode.ToString().ToUpper() + "_" + transferObj.TfereeBranchCode.ToString().ToUpper());
                    htTransferRegInfo.Add("TR_NO", Convert.ToInt32(transferObj.TransferNo.ToString()));

                    certArray = dtTransferSaleCert.Rows[loop]["CERTIFICATE"].ToString().Split('-');

                    htTransferRegInfo.Add("CERT_TYPE", certArray[0].ToString().ToUpper());
                    htTransferRegInfo.Add("CERT_NO", Convert.ToInt32(certArray[1].ToString()));
                    htTransferRegInfo.Add("CERTIFICATE", dtTransferSaleCert.Rows[loop]["CERTIFICATE"].ToString().ToUpper());
                    htTransferRegInfo.Add("QTY", Convert.ToInt32(dtTransferSaleCert.Rows[loop]["QTY"].ToString()));
                    htTransferRegInfo.Add("CURR_REG_BK", regObj.FundCode.ToString().ToUpper());
                    htTransferRegInfo.Add("CURR_REG_BR", transferObj.TfereeBranchCode.ToString().ToUpper());
                    htTransferRegInfo.Add("CURR_REG_NO", Convert.ToInt32(transferObj.TransfereeRegNo.ToString()));
                    htTransferRegInfo.Add("OLD_SL_TR_NO", Old_SL_TR_RN.ToString().ToUpper());

                    commonGatewayObj.Insert(htTransferRegInfo, "TRANS_CERT");
                }
                DataTable dtTransfer = dtTrnasfer(dtTransferSaleCert);
                for (int i = 0; i < dtTransfer.Rows.Count; i++)
                {
                    //htTransCertNoTemp = new Hashtable();
                    //htTransCertNoTemp.Add("F_CD", regObj.FundCode.ToString().ToUpper());
                    //htTransCertNoTemp.Add("BR_CODE", regObj.FundCode.ToString().ToUpper() + "_" + transferObj.TfereeBranchCode.ToString().ToUpper());
                    //htTransCertNoTemp.Add("TR_NO", Convert.ToInt32(transferObj.TransferNo.ToString()));
                    //htTransCertNoTemp.Add("CERTIFICATE", dtTransfer.Rows[i]["CERTIFICATE"].ToString());
                    //htTransCertNoTemp.Add("OLD_SL_TR_NO", dtTransfer.Rows[i]["SL_NO"].ToString());
                    // commonGatewayObj.Insert(htTransCertNoTemp, "TRANS_CERT_NO_TEMP");

                    htTransferRegInfo = new Hashtable();
                    htTransferRegInfo.Add("F_CD", regObj.FundCode.ToString().ToUpper());
                    htTransferRegInfo.Add("BR_CODE", regObj.FundCode.ToString().ToUpper() + "_" + transferObj.TfereeBranchCode.ToString().ToUpper());
                    htTransferRegInfo.Add("TR_NO", Convert.ToInt32(transferObj.TransferNo.ToString()));
                    htTransferRegInfo.Add("TR_DT", Convert.ToDateTime(transferObj.TransferDate.ToString()).ToString("dd-MMM-yyyy"));
                    htTransferRegInfo.Add("REG_BK_O", regObj.FundCode.ToString().ToUpper());
                    htTransferRegInfo.Add("REG_BR_O", transferObj.TferorBranchCode.ToString().ToUpper());
                    htTransferRegInfo.Add("REG_NO_O", Convert.ToInt32(transferObj.TransferorRegNo.ToString()));
                    htTransferRegInfo.Add("QTY", Convert.ToInt32(dtTransfer.Rows[i]["QTY"].ToString()));
                    htTransferRegInfo.Add("REG_BK_I", regObj.FundCode.ToString().ToUpper());
                    htTransferRegInfo.Add("REG_BR_I", transferObj.TfereeBranchCode.ToString().ToUpper());
                    htTransferRegInfo.Add("REG_NO_I", Convert.ToInt32(transferObj.TransfereeRegNo.ToString()));
                    htTransferRegInfo.Add("USER_NM", unitUserObj.UserID.ToString());
                    htTransferRegInfo.Add("ENT_DT", DateTime.Now.ToString());
                    htTransferRegInfo.Add("ENT_TM", DateTime.Now.ToShortTimeString().ToString());
                    htTransferRegInfo.Add("OLD_SL_TR_NO", dtTransfer.Rows[i]["SL_NO"].ToString());
                    commonGatewayObj.Insert(htTransferRegInfo, "TRANSFER");
                }
                commonGatewayObj.CommitTransaction();
            }
            catch (Exception ex)
            {
                commonGatewayObj.RollbackTransaction();
                throw ex;
            }
        }
Esempio n. 23
0
    protected void PrintSaveButton_Click(object sender, EventArgs e)
    {
        UnitHolderRegistration regObj = new UnitHolderRegistration();

        long      money_Receipt_ID     = 0;
        Hashtable htInsertMoneyReceipt = new Hashtable();

        try
        {
            regObj.FundCode   = fundCodeDDL.SelectedValue.ToString();
            regObj.BranchCode = branchCodeDDL.SelectedValue.ToString();
            regObj.RegNumber  = regNoTextBox.Text.Trim();
            CDSStatus         = opendMFDAO.getCDSStatus(fundCodeDDL.SelectedValue.ToString());
            decimal TotalUnitsBalance = 0;
            if (CDSStatus == "Y")
            {
                TotalUnitsBalance = opendMFDAO.getTotalSaleUnitBalanceCDS(regObj);
            }
            else
            {
                TotalUnitsBalance = opendMFDAO.getTotalSaleUnitBalance(regObj);
            }
            decimal unitQty = Convert.ToDecimal(QtyTextBox.Text.Trim());
            if (unitQty > TotalUnitsBalance)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "Popup", "alert('Save Failed: Insufficient Units');", true);
            }
            else if (unitSaleBLObj.CheckDuplicateMoneyReceiptNo(regObj, "REP", Convert.ToInt64(ReceiptNoTextBox.Text.Trim())))
            {
                ClientScript.RegisterStartupScript(this.GetType(), "Popup", "alert('" + msgObj.Duplicate().ToString() + " " + "Receipt Number " + "');", true);
            }
            else
            {
                money_Receipt_ID = commonGatewayObj.GetMaxNo("MONEY_RECEIPT", "ID") + 1;
                commonGatewayObj.BeginTransaction();
                htInsertMoneyReceipt.Add("ID", money_Receipt_ID);
                htInsertMoneyReceipt.Add("RECEIPT_NO", ReceiptNoTextBox.Text.Trim());
                htInsertMoneyReceipt.Add("RECEIPT_TYPE", "REP");
                htInsertMoneyReceipt.Add("RECEIPT_DATE", ReceiptDateTextBox.Text.Trim());
                htInsertMoneyReceipt.Add("REG_BK", fundCodeDDL.SelectedValue.ToString());
                htInsertMoneyReceipt.Add("REG_BR", branchCodeDDL.SelectedValue.ToString());
                htInsertMoneyReceipt.Add("REG_NO", regNoTextBox.Text.Trim());

                if (holderBOTextBox.Text.Trim() != "")
                {
                    htInsertMoneyReceipt.Add("BO", holderBOTextBox.Text.Trim());
                }
                htInsertMoneyReceipt.Add("HNAME", NameTextBox.Text.Trim());
                htInsertMoneyReceipt.Add("ADDRESS", addressTextBox.Text.Trim());
                htInsertMoneyReceipt.Add("UNIT_QTY", QtyTextBox.Text.Trim());
                htInsertMoneyReceipt.Add("RATE", RateTextBox.Text.Trim());
                htInsertMoneyReceipt.Add("SL_TR_RN_NO", SaleTRRNNoTextBox.Text.Trim().ToUpper());
                if (EFTRadioButton.Checked)
                {
                    htInsertMoneyReceipt.Add("REP_PAY_TYPE", "EFT");
                }
                else
                {
                    htInsertMoneyReceipt.Add("REP_PAY_TYPE", "CHQ");
                }
                htInsertMoneyReceipt.Add("REP_PAY_DATE", PayDateTextBox.Text.Trim());
                htInsertMoneyReceipt.Add("RECEIPT_ENTRY_BY", userObj.UserID.ToString());
                htInsertMoneyReceipt.Add("RECEIPT_ENTRY_DATE", DateTime.Today.ToString("dd-MMM-yyyy"));

                commonGatewayObj.Insert(htInsertMoneyReceipt, "MONEY_RECEIPT");
                commonGatewayObj.CommitTransaction();
                ClearText();
                Session["MONEY_RECEIPT_ID"]   = money_Receipt_ID.ToString();
                Session["MONEY_RECEIPT_TYPE"] = "REP";
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "window.open('ReportViewer/UnitReportMoneyReceiptReportViewer.aspx');", true);
            }
        }

        catch (Exception ex)
        {
            commonGatewayObj.RollbackTransaction();
            Session["MONEY_RECEIPT_ID"]   = null;
            Session["MONEY_RECEIPT_TYPE"] = null;
            ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert('Save and print Failed');", true);
        }
    }
    protected void SaveButton_Click(object sender, EventArgs e)
    {
        UnitHolderRegistration regObj = new UnitHolderRegistration();

        regObj.FundCode   = fundCodeTextBox.Text;
        regObj.BranchCode = branchCodeTextBox.Text;
        regObj.RegNumber  = regNoTextBox.Text;



        UnitSale saleObj = new UnitSale();

        saleObj.SaleNo = Convert.ToInt32(saleNumberTextBox.Text.Trim().ToString());
        if (moneyReceipDropDownList.SelectedValue.ToString() != "0")
        {
            saleObj.MoneyReceiptNo = Convert.ToInt32(moneyReceipDropDownList.SelectedItem.Text.ToString());
        }
        if (ChqRadioButton.Checked)
        {
            saleObj.PaymentType = ChequeTypeDropDownList.SelectedValue.ToString();
            if (CHQDDNoRemarksTextBox.Text.Trim() != "")
            {
                saleObj.ChequeNo = CHQDDNoRemarksTextBox.Text.Trim().ToString();
            }
            if (chequeDateTextBox.Text.Trim() != "")
            {
                saleObj.ChequeDate = chequeDateTextBox.Text.Trim().ToString();
            }
            if (bankNameDropDownList.SelectedValue.Trim() != "0")
            {
                saleObj.BankCode = Convert.ToInt16(bankNameDropDownList.SelectedValue.ToString());
            }
            if (branchNameDropDownList.SelectedValue.Trim() != "0" && branchNameDropDownList.SelectedValue.Trim() != "")
            {
                saleObj.BranchCode = Convert.ToInt16(branchNameDropDownList.SelectedValue.ToString());
            }
        }
        else if (CashRadioButton.Checked)
        {
            saleObj.PaymentType = "CASH";
            saleObj.CashAmount  = Convert.ToDecimal(Convert.ToDecimal(saleRateTextBox.Text.Trim().ToString()) * Convert.ToInt32(unitQtyTextBox.Text.Trim().ToString()));
        }
        else if (BothRadioButton.Checked)
        {
            saleObj.PaymentType = "BOTH";
            saleObj.ChequeNo    = CHQDDNoRemarksTextBox.Text.Trim().ToString();
            if (CHQDDNoRemarksTextBox.Text.Trim() != "")
            {
                saleObj.ChequeNo = CHQDDNoRemarksTextBox.Text.Trim().ToString();
            }
            if (chequeDateTextBox.Text.Trim() != "")
            {
                saleObj.ChequeDate = chequeDateTextBox.Text.Trim().ToString();
            }
            if (bankNameDropDownList.SelectedValue.Trim() != "0")
            {
                saleObj.BankCode = Convert.ToInt16(bankNameDropDownList.SelectedValue.ToString());
            }
            if (branchNameDropDownList.SelectedValue.Trim() != "0" || branchNameDropDownList.SelectedValue.Trim() != "")
            {
                saleObj.BranchCode = Convert.ToInt16(branchNameDropDownList.SelectedValue.ToString());
            }
            if (CashAmountTextBox.Text.Trim() != "")
            {
                saleObj.CashAmount = Convert.ToDecimal(CashAmountTextBox.Text.Trim().ToString());
            }
        }
        else if (MultiRadioButton.Checked)
        {
            saleObj.PaymentType = "MULTI";
            if (MultiplePayTypeTextBox.Text.Trim() != "")
            {
                saleObj.MultiPayType = MultiplePayTypeTextBox.Text.Trim().ToString();
            }
        }
        saleObj.SaleRate    = Convert.ToDecimal(saleRateTextBox.Text.Trim().ToString());
        saleObj.SaleType    = saleTypeDropDownList.SelectedValue.ToString().ToUpper();
        saleObj.SaleUnitQty = Convert.ToInt32(unitQtyTextBox.Text.Trim().ToString());
        saleObj.SaleDate    = saleDateTextBox.Text.Trim().ToString();
        saleObj.SaleRemarks = saleRemarksTextBox.Text.Trim().ToString();
        int  saleLimitLower  = unitSaleBLObj.SaleLimitLower(regObj);
        long saleLimmitUpper = unitSaleBLObj.SaleLimitUpper(regObj);



        try
        {
            if (unitSaleBLObj.IsSaleLock(regObj))//Cheking Lock in status
            {
                ClientScript.RegisterStartupScript(this.GetType(), "Popup", "alert('" + msgObj.Error().ToString() + " " + " Sale Operation is Locked " + "');", true);
            }
            else if (unitSaleBLObj.IsDuplicateSale(regObj, saleObj))// Checking Duplicate Sale No
            {
                ClientScript.RegisterStartupScript(this.GetType(), "Popup", "alert('" + msgObj.Duplicate().ToString() + " " + "Sale Number " + "');", true);
            }
            else if (saleLimitLower > Convert.ToInt32(unitQtyTextBox.Text.Trim().ToString()) && saleTypeDropDownList.SelectedValue.ToString() == "SL")
            {
                unitQtyTextBox.Focus();
                ClientScript.RegisterStartupScript(this.GetType(), "Popup", "alert('Sale Unit Quantity can not less than " + saleLimitLower.ToString() + "');", true);
            }
            else if (saleLimmitUpper < Convert.ToInt32(unitQtyTextBox.Text.Trim().ToString()))
            {
                unitQtyTextBox.Focus();
                ClientScript.RegisterStartupScript(this.GetType(), "Popup", "alert('Sale Unit Quantity can not greater than " + saleLimmitUpper.ToString() + "');", true);
            }
            else
            {
                commonGatewayObj.BeginTransaction();
                commonGatewayObj.ExecuteNonQuery("UPDATE U_MASTER SET SELLING_AGENT_ID=" + saleObj.SellingAgentCode + "  WHERE  REG_BK='" + regObj.FundCode + "' AND REG_BR='" + regObj.BranchCode + "' AND REG_NO='" + regObj.RegNumber + "' AND SELLING_AGENT_ID IS NULL");
                commonGatewayObj.ExecuteNonQuery("UPDATE MONEY_RECEIPT SET SL_REP_TR_RN_NO=" + saleObj.SaleNo + "  WHERE ID=" + Convert.ToUInt64(moneyReceipDropDownList.SelectedValue.ToString()));
                unitSaleBLObj.SaveUnitSaleCDS(regObj, saleObj, userObj);
                commonGatewayObj.CommitTransaction();
                ClearText();
                moneyReceipDropDownList.DataSource     = unitSaleBLObj.dtMoneyRecieptInfoforDDL(regObj, "SL");
                moneyReceipDropDownList.DataTextField  = "RECEIPT_NO";
                moneyReceipDropDownList.DataValueField = "ID";
                moneyReceipDropDownList.DataBind();
                ClientScript.RegisterStartupScript(this.GetType(), "Popup", "alert('" + msgObj.Success().ToString() + "');", true);
            }
        }
        catch (Exception ex)
        {
            commonGatewayObj.RollbackTransaction();
            errorMassege = msgObj.ExceptionErrorMessageString(ex.Message.ToString());
            ClientScript.RegisterStartupScript(this.GetType(), "Popup", "alert ('" + msgObj.Error().ToString() + " " + errorMassege.ToString() + "');", true);
        }
    }
Esempio n. 25
0
    public void SaveAccountVoucherWithChequePayment(string accountSchema)
    {
        try
        {
            int  countCheck   = 0;
            long tranNumber   = commonGatewayObj.GetMaxNo(accountSchema + ".GL_BASICINFO", "TRAN_ID");
            long contrlNumber = commonGatewayObj.GetMaxNo(accountSchema + ".GL_BASICINFO", "TO_NUMBER(CTRLNO)") - 1;

            string acc_op_id       = unitRepBLObj.getAcc_OP_ID(fundNameDropDownList.SelectedValue.ToString());
            long   acc_terminal_no = unitRepBLObj.getAcc_terminal_no(fundNameDropDownList.SelectedValue.ToString());

            int       faceValue           = unitRepBLObj.getUnitFaceValue(fundNameDropDownList.SelectedValue.ToString());
            string    bankPaymentCode     = unitRepBLObj.getUnitBankPaymentCode(fundNameDropDownList.SelectedValue.ToString());
            string    getUnitFundBankCode = unitRepBLObj.getUnitFundBankCode(fundNameDropDownList.SelectedValue.ToString());
            Hashtable htInsert            = new Hashtable();
            Hashtable htUpdate            = new Hashtable();
            commonGatewayObj.BeginTransaction();
            DataTable dtFundYearEndInfo = commonGatewayObj.Select("SELECT * FROM FUND_INFO WHERE FUND_CD='" + fundNameDropDownList.SelectedValue.ToString() + "'");
            int       year          = Convert.ToDateTime(TranDateTextBox.Text.ToString()).Year;
            int       month         = Convert.ToDateTime(TranDateTextBox.Text.ToString()).Month;
            string    yearStartDate = dtFundYearEndInfo.Rows[0]["YEAR_START_MONTH"].ToString();
            string    yearEndDate   = dtFundYearEndInfo.Rows[0]["YEAR_END_MONTH"].ToString();
            if (yearStartDate == "01-JUL")
            {
                if (month < 6)
                {
                    yearEndDate = yearEndDate + "-" + year.ToString();
                    year--;
                    yearStartDate = yearStartDate + "-" + year.ToString();
                }
                else
                {
                    yearStartDate = yearStartDate + "-" + year.ToString();
                    year++;
                    yearEndDate = yearEndDate + "-" + year.ToString();
                }
            }
            else
            {
                yearStartDate = yearStartDate + "-" + year.ToString();
                yearEndDate   = yearEndDate + "-" + year.ToString();
            }
            if (unitRepBLObj.IsDuplicateAccVoucherNo(accountSchema, VoucherNoTexBox.Text.Trim(), "1", yearStartDate, yearEndDate))
            {
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert('Save Failed Duplicate Payment Voucher Number');", true);
            }
            else
            {
                foreach (GridViewRow Drv in SurrenderListGridView.Rows)
                {
                    CheckBox leftCheckBox = (CheckBox)SurrenderListGridView.Rows[countCheck].FindControl("leftCheckBox");
                    //TextBox VoucherNoTexBox = (TextBox)SurrenderListGridView.Rows[countCheck].FindControl("VoucherNumberTextBox");
                    TextBox ChequeNoTexBox = (TextBox)SurrenderListGridView.Rows[countCheck].FindControl("ChequeNumberTextBox");

                    if (leftCheckBox.Checked)
                    {
                        decimal unitFaceValue      = Convert.ToDecimal(faceValue);
                        decimal unitSaleQty        = Convert.ToDecimal(Drv.Cells[8].Text.ToString());
                        decimal unitSaleRate       = Convert.ToDecimal(Drv.Cells[9].Text.ToString());
                        decimal unitSaleTotalValue = Convert.ToDecimal(Drv.Cells[10].Text.ToString());

                        DataTable dtHolderBankInfo = unitRepBLObj.dtGetHolderBankInfo(Drv.Cells[2].Text.ToUpper().ToString(), Drv.Cells[3].Text.ToUpper().ToString(), Convert.ToInt32(Drv.Cells[4].Text.ToString()));


                        htUpdate = new Hashtable();
                        if (dtHolderBankInfo.Rows.Count > 0)
                        {
                            htUpdate.Add("HOLDER_AC_NO", dtHolderBankInfo.Rows[0]["BK_AC_NO"].ToString());
                            htUpdate.Add("HOLDER_ROUTING_NO", dtHolderBankInfo.Rows[0]["ROUTING_NO"].ToString());
                        }
                        htUpdate.Add("CHEQUE_DATE", ChequeDateTextBox.Text.ToString());
                        htUpdate.Add("CHEQUE_POSTED_BY", userObj.UserID.ToString());
                        htUpdate.Add("CHEQUE_POSTED_DATE", DateTime.Now.ToString());
                        htUpdate.Add("VOUCHER_NO", VoucherNoTexBox.Text.Trim().ToString());
                        htUpdate.Add("CHEQUE_NO", ChequeNoTexBox.Text.Trim().ToString());
                        if (unitRepBLObj.IsValidMobileNumber(regObj))
                        {
                            htUpdate.Add("SMS_CREATE_DATE", DateTime.Now.ToString());
                        }


                        htUpdate.Add("SIGNATORY1_ID", Signatory1DropDownList.SelectedValue.ToUpper().ToString());
                        htUpdate.Add("SIGANTORY2_ID", Signatory2DropDownList.SelectedValue.ToUpper().ToString());
                        htUpdate.Add("FUND_INFO_BANK_CODE", getUnitFundBankCode);

                        commonGatewayObj.Update(htUpdate, "REPURCHASE ", "REG_BK='" + Drv.Cells[2].Text.ToUpper().ToString() + "' AND REG_BR='" + Drv.Cells[3].Text.ToUpper().ToString() + "' AND REG_NO=" + Convert.ToInt32(Drv.Cells[4].Text.ToString()) + " AND REP_NO=" + Convert.ToInt32(Drv.Cells[5].Text.ToString()));
                        contrlNumber++;
                        htInsert = new Hashtable();
                        htInsert.Add("TRAN_ID", tranNumber + 1);
                        htInsert.Add("ACCCODE", "101010000");
                        htInsert.Add("BANKACNO", "101010000");
                        htInsert.Add("TRAN_TIME", DateTime.Now.ToShortTimeString());
                        htInsert.Add("TRAN_DATE", TranDateTextBox.Text.Trim());
                        htInsert.Add("REMARKS", unitSaleQty.ToString() + " unit surrendered @tk." + unitSaleRate.ToString() + " per unit ");
                        htInsert.Add("TRAN_TYPE", "D");
                        htInsert.Add("VOUCHER_NO", VoucherNoTexBox.Text.Trim().ToString());
                        htInsert.Add("TOTAL_AMNT", Convert.ToDecimal(unitFaceValue * unitSaleQty));
                        htInsert.Add("CTRLNO", contrlNumber);
                        htInsert.Add("OP_ID", userObj.UserID.ToString());
                        htInsert.Add("VOUCHER_TYPE", "1");
                        htInsert.Add("TERMINAL_NO", acc_terminal_no);
                        htInsert.Add("RECENT", "y");
                        htInsert.Add("LATESTDEL", "m");
                        htInsert.Add("ISOUT", "N");
                        htInsert.Add("ISREV", "N");
                        htInsert.Add("OLDDATA", "N");


                        commonGatewayObj.Insert(htInsert, accountSchema + ".GL_TRAN");

                        if (unitSaleRate < unitFaceValue)
                        {
                            contrlNumber++;

                            htInsert = new Hashtable();
                            htInsert.Add("TRAN_ID", tranNumber + 1);
                            htInsert.Add("ACCCODE", "101020000");
                            htInsert.Add("BANKACNO_CONTRA", "101020000");
                            htInsert.Add("TRAN_TIME", DateTime.Now.ToShortTimeString());
                            htInsert.Add("TRAN_DATE", TranDateTextBox.Text.Trim());
                            htInsert.Add("REMARKS", unitSaleQty.ToString() + " unit surrendered @tk." + unitSaleRate.ToString() + " per unit ");
                            htInsert.Add("TRAN_TYPE", "C");
                            htInsert.Add("VOUCHER_NO", VoucherNoTexBox.Text.Trim().ToString());
                            htInsert.Add("TOTAL_AMNT", Convert.ToDecimal((unitFaceValue * unitSaleQty) - unitSaleTotalValue));
                            htInsert.Add("CTRLNO", contrlNumber);
                            htInsert.Add("OP_ID", userObj.UserID.ToString());
                            htInsert.Add("VOUCHER_TYPE", "1");
                            htInsert.Add("TERMINAL_NO", acc_terminal_no);
                            htInsert.Add("RECENT", "y");
                            htInsert.Add("LATESTDEL", "m");
                            htInsert.Add("ISOUT", "N");
                            htInsert.Add("ISREV", "N");
                            htInsert.Add("OLDDATA", "N");
                            commonGatewayObj.Insert(htInsert, accountSchema + ".GL_TRAN");
                        }
                        else if (unitSaleRate > unitFaceValue)
                        {
                            contrlNumber++;
                            htInsert = new Hashtable();
                            htInsert.Add("TRAN_ID", tranNumber + 1);
                            htInsert.Add("ACCCODE", "101020000");
                            htInsert.Add("BANKACNO", "101020000");
                            htInsert.Add("TRAN_TIME", DateTime.Now.ToShortTimeString());
                            htInsert.Add("TRAN_DATE", TranDateTextBox.Text.Trim());
                            htInsert.Add("REMARKS", unitSaleQty.ToString() + " unit surrendered @tk." + unitSaleRate.ToString() + " per unit ");
                            htInsert.Add("TRAN_TYPE", "D");
                            htInsert.Add("VOUCHER_NO", VoucherNoTexBox.Text.Trim().ToString());
                            htInsert.Add("TOTAL_AMNT", Convert.ToDecimal(unitSaleTotalValue - ((unitFaceValue * unitSaleQty))));
                            htInsert.Add("CTRLNO", contrlNumber);
                            htInsert.Add("OP_ID", userObj.UserID.ToString());
                            htInsert.Add("VOUCHER_TYPE", "1");
                            htInsert.Add("TERMINAL_NO", acc_terminal_no);
                            htInsert.Add("RECENT", "y");
                            htInsert.Add("LATESTDEL", "m");
                            htInsert.Add("ISOUT", "N");
                            htInsert.Add("ISREV", "N");
                            htInsert.Add("OLDDATA", "N");
                            commonGatewayObj.Insert(htInsert, accountSchema + ".GL_TRAN");
                        }
                        contrlNumber++;
                        htInsert = new Hashtable();
                        htInsert.Add("TRAN_ID", tranNumber + 1);
                        htInsert.Add("ACCCODE", bankPaymentCode);
                        htInsert.Add("BANKACNO_CONTRA", bankPaymentCode);
                        htInsert.Add("TRAN_TIME", DateTime.Now.ToShortTimeString());
                        htInsert.Add("TRAN_DATE", TranDateTextBox.Text.Trim());
                        htInsert.Add("REMARKS", unitSaleQty.ToString() + " unit surrendered @tk." + unitSaleRate.ToString() + " per unit ");
                        htInsert.Add("TRAN_TYPE", "C");
                        htInsert.Add("VOUCHER_NO", VoucherNoTexBox.Text.Trim().ToString());
                        htInsert.Add("TOTAL_AMNT", Convert.ToDecimal(unitSaleTotalValue));
                        htInsert.Add("CTRLNO", contrlNumber);
                        htInsert.Add("OP_ID", userObj.UserID.ToString());
                        htInsert.Add("VOUCHER_TYPE", "1");
                        htInsert.Add("CHEQUENO", ChequeNoTexBox.Text.Trim().ToString());
                        htInsert.Add("CHEQUE_DATE", ChequeDateTextBox.Text.Trim());
                        htInsert.Add("TERMINAL_NO", acc_terminal_no);
                        htInsert.Add("RECENT", "y");
                        htInsert.Add("LATESTDEL", "m");
                        htInsert.Add("ISOUT", "N");
                        htInsert.Add("ISREV", "N");
                        htInsert.Add("OLDDATA", "N");
                        commonGatewayObj.Insert(htInsert, accountSchema + ".GL_TRAN");
                    }

                    countCheck++;
                }

                contrlNumber++;
                tranNumber++;
                commonGatewayObj.ExecuteNonQuery(" UPDATE " + accountSchema + ".GL_BASICINFO SET TRAN_ID=" + tranNumber + " , CTRLNO='" + contrlNumber + "' WHERE 1=1");
                commonGatewayObj.CommitTransaction();
            }
        }
        catch (Exception ex)
        {
            commonGatewayObj.RollbackTransaction();
            throw ex;
        }
    }
    protected void SaveButton_Click(object sender, EventArgs e)
    {
        try
        {
            int countRows = 0;
            commonGatewayObj.BeginTransaction();

            DataTable dtTradeCustDSE = (DataTable)Session["dtTradeCusetDSE"];
            if (dtTradeCustDSE.Rows.Count > 0)
            {
                //   dt.Rows[0]["vch_dt"].ToString();
                string    howlaDate = dtTradeCustDSE.Rows[0]["SP_DATE"].ToString();
                DataTable dtMarketPriceByHowladate = new DataTable();
                PfolioBL  pfolioBLObj = new PfolioBL();
                if (!pfolioBLObj.getMPUpdateStatus(howlaDate, "AVERAGE"))
                {
                    grdShowDSEMP.Visible   = false;
                    DSETradeCustLabel.Text = "Save Failed: Market price is not updated";
                    DSETradeCustLabel.Style.Add("color", "red");
                }
                else
                {
                    if (!pfolioBLObj.getHowlaUpdateStatus(HowlaDateTextBox.Text.ToString(), "DSE"))
                    {
                        if (dvGridDSETradeInfo.Visible == true)
                        {
                            Hashtable htTradeCustDSE = new Hashtable();
                            for (int loop = 0; loop < dtTradeCustDSE.Rows.Count; loop++)
                            {
                                htTradeCustDSE.Add("F_CD", dtTradeCustDSE.Rows[loop]["F_CD"]);
                                htTradeCustDSE.Add("SP_DATE", dtTradeCustDSE.Rows[loop]["SP_DATE"]);
                                htTradeCustDSE.Add("BK_REF", dtTradeCustDSE.Rows[loop]["BK_REF"]);
                                htTradeCustDSE.Add("HOWLA_NO", dtTradeCustDSE.Rows[loop]["HOWLA_NO"]);

                                htTradeCustDSE.Add("HOWLA_TP", dtTradeCustDSE.Rows[loop]["HOWLA_TP"]);
                                htTradeCustDSE.Add("IN_OUT", dtTradeCustDSE.Rows[loop]["IN_OUT"]);
                                htTradeCustDSE.Add("SETTLE_DT", dtTradeCustDSE.Rows[loop]["SETTLE_DT"]);
                                htTradeCustDSE.Add("COMP_CD", dtTradeCustDSE.Rows[loop]["COMP_CD"]);

                                htTradeCustDSE.Add("SP_QTY", dtTradeCustDSE.Rows[loop]["SP_QTY"]);
                                htTradeCustDSE.Add("SP_RATE", dtTradeCustDSE.Rows[loop]["SP_RATE"]);
                                htTradeCustDSE.Add("CL_DATE", dtTradeCustDSE.Rows[loop]["CL_DATE"]);
                                htTradeCustDSE.Add("BK_CD", dtTradeCustDSE.Rows[loop]["BK_CD"]);

                                htTradeCustDSE.Add("HOWLA_CHG", dtTradeCustDSE.Rows[loop]["HOWLA_CHG"]);
                                htTradeCustDSE.Add("LAGA_CHG", dtTradeCustDSE.Rows[loop]["LAGA_CHG"]);
                                htTradeCustDSE.Add("VOUCH_REF", dtTradeCustDSE.Rows[loop]["VOUCH_REF"]);
                                htTradeCustDSE.Add("OP_NAME", dtTradeCustDSE.Rows[loop]["OP_NAME"]);

                                htTradeCustDSE.Add("N_P", dtTradeCustDSE.Rows[loop]["N_P"]);
                                htTradeCustDSE.Add("ISIN_CD", dtTradeCustDSE.Rows[loop]["ISIN_CD"]);
                                htTradeCustDSE.Add("FORGN_FLG", dtTradeCustDSE.Rows[loop]["FORGN_FLG"]);
                                htTradeCustDSE.Add("SPOT_ID", dtTradeCustDSE.Rows[loop]["SPOT_ID"]);

                                htTradeCustDSE.Add("INSTR_GRP", dtTradeCustDSE.Rows[loop]["INSTR_GRP"]);
                                htTradeCustDSE.Add("MARKT_TP", dtTradeCustDSE.Rows[loop]["MARKT_TP"]);
                                htTradeCustDSE.Add("CUSTOMER", dtTradeCustDSE.Rows[loop]["CUSTOMER"]);
                                htTradeCustDSE.Add("BOID", dtTradeCustDSE.Rows[loop]["BOID"]);



                                commonGatewayObj.Insert(htTradeCustDSE, "HOWLA");
                                htTradeCustDSE = new Hashtable();
                                countRows++;
                            }
                            commonGatewayObj.CommitTransaction();
                            dvGridDSETradeInfo.Visible = false;
                            Session["dtTradeCusetDSE"] = null;
                            DSETradeCustLabel.Text     = " Howla DSE " + countRows.ToString() + " Rows Save Successfully";
                            DSETradeCustLabel.Style.Add("color", "#009933");
                        }
                        else
                        {
                            DSETradeCustLabel.Text = "Save Failed: DSE Howla Already Saved On That Date";
                            DSETradeCustLabel.Style.Add("color", "red");
                        }
                    }
                    else
                    {
                        DSETradeCustLabel.Text = "Save Failed:Please  Press the Show DSE Howla button";
                        DSETradeCustLabel.Style.Add("color", "red");
                    }
                }

                //string strQuery = "select TO_CHAR(max(vch_dt),'DD-MON-YYYY')last_tr_dt,TO_CHAR(max(vch_dt) + 1,'DD-MON-YYYY')vch_dt  from fund_trans_hb where f_cd =" + dtFundNameDropDownList.Rows[i]["F_CD"].ToString() +
                //                  " and tran_tp in ('C','S') and stock_ex in ('C','A')";
                //dtMarketPriceByHowladate = commonGatewayObj.Select(strQuery);
            }
        }
        catch (Exception ex)
        {
            commonGatewayObj.RollbackTransaction();
            Session["dtTradeCusetDSE"] = null;
            DSETradeCustLabel.Text     = " Howla DSE Save failed Error:" + ex.Message.ToString();
            DSETradeCustLabel.Style.Add("color", "red");
        }
    }
Esempio n. 27
0
        public void saveRepurchase(DataTable dtTransferSaleCert, UnitHolderRegistration regObj, UnitRepurchase repObj, UnitUser unitUserObj)
        {
            try
            {
                UnitTransferBL unitTransferBLObj = new UnitTransferBL();
                commonGatewayObj.BeginTransaction();
                Hashtable htRepurchaseRegInfo = new Hashtable();
                Hashtable htCertNoTemp        = new Hashtable();
                int       SL_TR_RN            = 0;
                int       CertNo   = 0;
                string    certType = "";
                string[]  saleNoArray;
                string[]  certArray;
                string    statusFlag   = "R";
                string    Old_SL_TR_RN = "";

                for (int loop = 0; loop < dtTransferSaleCert.Rows.Count; loop++)
                {
                    if (dtTransferSaleCert.Rows[loop]["SL_NO"].ToString().ToUpper().IndexOf('S') >= 0)
                    {
                        htRepurchaseRegInfo = new Hashtable();
                        htRepurchaseRegInfo.Add("CURR_REG_BK", regObj.FundCode.ToString().ToUpper());
                        htRepurchaseRegInfo.Add("CURR_REG_BR", regObj.BranchCode.ToString().ToUpper());
                        htRepurchaseRegInfo.Add("CURR_REG_NO", regObj.RegNumber.ToString());
                        htRepurchaseRegInfo.Add("STATUS_FLAG", statusFlag.ToUpper().ToString());

                        saleNoArray = dtTransferSaleCert.Rows[loop]["SL_NO"].ToString().Split('S');
                        SL_TR_RN    = Convert.ToInt32(saleNoArray[1].ToString());
                        certArray   = dtTransferSaleCert.Rows[loop]["CERTIFICATE"].ToString().Split('-');
                        CertNo      = Convert.ToInt32(certArray[1].ToString());
                        certType    = certArray[0].ToString().ToUpper();
                        commonGatewayObj.Update(htRepurchaseRegInfo, "SALE_CERT", "REG_NO=" + Convert.ToInt32(regObj.RegNumber) + " AND REG_BK='" + regObj.FundCode.ToString().ToUpper() + "' AND REG_BR='" + regObj.BranchCode.ToString().ToUpper() + "' AND  SL_NO=" + SL_TR_RN + " AND CERT_NO=" + CertNo + " AND CERT_TYPE='" + certType + "'");

                        Old_SL_TR_RN = "S" + SL_TR_RN.ToString();
                    }
                    else if (dtTransferSaleCert.Rows[loop]["SL_NO"].ToString().ToUpper().IndexOf('T') >= 0)
                    {
                        htRepurchaseRegInfo = new Hashtable();
                        htRepurchaseRegInfo.Add("CURR_REG_BK", regObj.FundCode.ToString().ToUpper());
                        htRepurchaseRegInfo.Add("CURR_REG_BR", regObj.BranchCode.ToString().ToUpper());
                        htRepurchaseRegInfo.Add("CURR_REG_NO", regObj.RegNumber.ToString());
                        htRepurchaseRegInfo.Add("STATUS_FLAG", statusFlag.ToUpper().ToString());


                        saleNoArray = dtTransferSaleCert.Rows[loop]["SL_NO"].ToString().Split('T');
                        SL_TR_RN    = Convert.ToInt32(saleNoArray[1].ToString());
                        certArray   = dtTransferSaleCert.Rows[loop]["CERTIFICATE"].ToString().Split('-');
                        CertNo      = Convert.ToInt32(certArray[1].ToString());
                        certType    = certArray[0].ToString().ToUpper();


                        commonGatewayObj.Update(htRepurchaseRegInfo, "TRANS_CERT", "F_CD='" + regObj.FundCode.ToString().ToUpper() + "'  AND CERT_NO=" + CertNo + " AND CERT_TYPE='" + certType + "'");
                        commonGatewayObj.Update(htRepurchaseRegInfo, "SALE_CERT", "REG_BK='" + regObj.FundCode.ToString().ToUpper() + "' AND REG_BR='" + regObj.BranchCode.ToString().ToUpper() + "' AND CERT_NO=" + CertNo + " AND CERT_TYPE='" + certType + "'");
                        commonGatewayObj.Update(htRepurchaseRegInfo, "RENEWAL_OUT", "REG_BK='" + regObj.FundCode.ToString().ToUpper() + "' AND REG_BR='" + regObj.BranchCode.ToString().ToUpper() + "' AND CERT_NO=" + CertNo + " AND CERT_TYPE='" + certType + "'");

                        Old_SL_TR_RN = "T" + SL_TR_RN.ToString();
                    }
                    else if (dtTransferSaleCert.Rows[loop]["SL_NO"].ToString().ToUpper().IndexOf('R') >= 0)
                    {
                        htRepurchaseRegInfo = new Hashtable();
                        htRepurchaseRegInfo.Add("CURR_REG_BK", regObj.FundCode.ToString().ToUpper());
                        htRepurchaseRegInfo.Add("CURR_REG_BR", regObj.BranchCode.ToString().ToUpper());
                        htRepurchaseRegInfo.Add("CURR_REG_NO", regObj.RegNumber.ToString());
                        htRepurchaseRegInfo.Add("STATUS_FLAG", statusFlag.ToUpper().ToString());


                        saleNoArray = dtTransferSaleCert.Rows[loop]["SL_NO"].ToString().Split('R');
                        SL_TR_RN    = Convert.ToInt32(saleNoArray[1].ToString());
                        certArray   = dtTransferSaleCert.Rows[loop]["CERTIFICATE"].ToString().Split('-');
                        CertNo      = Convert.ToInt32(certArray[1].ToString());
                        certType    = certArray[0].ToString().ToUpper();

                        commonGatewayObj.Update(htRepurchaseRegInfo, "RENEWAL_OUT", "REG_NO=" + Convert.ToInt32(regObj.RegNumber) + " AND REG_BK='" + regObj.FundCode.ToString().ToUpper() + "' AND REG_BR='" + regObj.BranchCode.ToString().ToUpper() + "' AND CERT_NO=" + CertNo + " AND CERT_TYPE='" + certType + "'");

                        Old_SL_TR_RN = "R" + SL_TR_RN.ToString();
                    }



                    htRepurchaseRegInfo = new Hashtable();
                    htRepurchaseRegInfo.Add("REG_BK", regObj.FundCode.ToString().ToUpper());
                    htRepurchaseRegInfo.Add("REG_BR", regObj.BranchCode.ToString().ToUpper());
                    htRepurchaseRegInfo.Add("REP_NO", Convert.ToInt32(repObj.RepurchaseNo.ToString()));
                    htRepurchaseRegInfo.Add("REG_NO", Convert.ToInt32(regObj.RegNumber.ToString()));

                    certArray = dtTransferSaleCert.Rows[loop]["CERTIFICATE"].ToString().Split('-');

                    htRepurchaseRegInfo.Add("CERT_TYPE", certArray[0].ToString().ToUpper());
                    htRepurchaseRegInfo.Add("CERT_NO", Convert.ToInt32(certArray[1].ToString()));
                    htRepurchaseRegInfo.Add("CERTIFICATE", dtTransferSaleCert.Rows[loop]["CERTIFICATE"].ToString().ToUpper());
                    htRepurchaseRegInfo.Add("QTY", Convert.ToInt32(dtTransferSaleCert.Rows[loop]["QTY"].ToString()));
                    htRepurchaseRegInfo.Add("SL_TR_NO", Old_SL_TR_RN.ToString().ToUpper());

                    commonGatewayObj.Insert(htRepurchaseRegInfo, "REP_CERT_NO");
                }



                DataTable dtTransfer = unitTransferBLObj.dtTrnasfer(dtTransferSaleCert);
                for (int i = 0; i < dtTransfer.Rows.Count; i++)
                {
                    htRepurchaseRegInfo = new Hashtable();
                    htRepurchaseRegInfo.Add("REP_NO", Convert.ToInt32(repObj.RepurchaseNo.ToString()));
                    htRepurchaseRegInfo.Add("REP_DT", Convert.ToDateTime(repObj.RepurchaseDate.ToString()).ToString("dd-MMM-yyyy"));
                    htRepurchaseRegInfo.Add("SL_TR_NO", dtTransfer.Rows[i]["SL_NO"].ToString());
                    htRepurchaseRegInfo.Add("REG_BK", regObj.FundCode.ToString().ToUpper());
                    htRepurchaseRegInfo.Add("REG_BR", regObj.BranchCode.ToString().ToUpper());
                    htRepurchaseRegInfo.Add("REG_NO", regObj.RegNumber.ToString());
                    htRepurchaseRegInfo.Add("REP_PRICE", decimal.Parse(repObj.RepurchaseRate.ToString()));
                    htRepurchaseRegInfo.Add("QTY", Convert.ToInt32(dtTransfer.Rows[i]["QTY"].ToString()));
                    htRepurchaseRegInfo.Add("PAY_TYPE", repObj.PayType.ToString().ToUpper());
                    htRepurchaseRegInfo.Add("USER_NM", unitUserObj.UserID.ToString());
                    htRepurchaseRegInfo.Add("ENT_DT", DateTime.Now.ToString());
                    htRepurchaseRegInfo.Add("ENT_TM", DateTime.Now.ToShortTimeString().ToString());

                    if (repObj.ChequeIssueTo == null)
                    {
                        htRepurchaseRegInfo.Add("CHQ_ISSUE_TO", DBNull.Value);
                    }
                    else
                    {
                        htRepurchaseRegInfo.Add("CHQ_ISSUE_TO", repObj.ChequeIssueTo.ToString());
                    }

                    commonGatewayObj.Insert(htRepurchaseRegInfo, "REPURCHASE");
                }
                commonGatewayObj.CommitTransaction();
            }
            catch (Exception ex)
            {
                commonGatewayObj.RollbackTransaction();
                throw ex;
            }
        }
        public void SaveUnitRenewal(UnitHolderRegistration unitRegObj, DataTable dtTransferSaleCert, UnitRenewal renwalObj, DataTable dtDinomination, UnitUser unitUserObj)
        {
            Hashtable      htUnitSaleCert    = new Hashtable();
            Hashtable      htRenwal          = new Hashtable();
            Hashtable      htRenewalIN       = new Hashtable();
            Hashtable      htRenewalOUT      = new Hashtable();
            UnitTransferBL unitTransferBLObj = new UnitTransferBL();
            int            SL_TR_RN          = 0;
            int            CertNo            = 0;
            string         certType          = "";

            string[] saleNoArray;
            string[] certArray;
            string   valid        = "N";
            string   remarks      = "RENEWAL NO:" + renwalObj.RenewalNo.ToString();
            string   Old_SL_TR_RN = "";
            string   FORM_CODE    = "";

            if (renwalObj.RenewalType.ToString().ToUpper() == "S" || renwalObj.RenewalType.ToString().ToUpper() == "C")
            {
                FORM_CODE = "UNIT-UMA";
            }
            else if (renwalObj.RenewalType.ToString().ToUpper() == "S")
            {
                FORM_CODE = "UNIT-CHA";
            }
            try
            {
                commonGatewayObj.BeginTransaction();
                for (int loop = 0; loop < dtTransferSaleCert.Rows.Count; loop++)
                {
                    if (dtTransferSaleCert.Rows[loop]["SL_NO"].ToString().ToUpper().IndexOf('S') >= 0)
                    {
                        htUnitSaleCert = new Hashtable();
                        htUnitSaleCert.Add("VALID", valid);
                        htUnitSaleCert.Add("REMARKS", remarks);


                        saleNoArray = dtTransferSaleCert.Rows[loop]["SL_NO"].ToString().Split('S');
                        SL_TR_RN    = Convert.ToInt32(saleNoArray[1].ToString());
                        certArray   = dtTransferSaleCert.Rows[loop]["CERTIFICATE"].ToString().Split('-');
                        CertNo      = Convert.ToInt32(certArray[1].ToString());
                        certType    = certArray[0].ToString().ToUpper();
                        commonGatewayObj.Update(htUnitSaleCert, "SALE_CERT", "REG_NO=" + Convert.ToInt32(unitRegObj.RegNumber) + " AND REG_BK='" + unitRegObj.FundCode.ToString().ToUpper() + "' AND REG_BR='" + unitRegObj.BranchCode.ToString().ToUpper() + "' AND  SL_NO=" + SL_TR_RN + " AND CERT_NO=" + CertNo + " AND CERT_TYPE='" + certType + "'");

                        Old_SL_TR_RN = "S" + SL_TR_RN.ToString();
                    }
                    else if (dtTransferSaleCert.Rows[loop]["SL_NO"].ToString().ToUpper().IndexOf('T') >= 0)
                    {
                        htUnitSaleCert = new Hashtable();
                        htUnitSaleCert.Add("VALID", valid);
                        htUnitSaleCert.Add("REMARKS", remarks);


                        saleNoArray = dtTransferSaleCert.Rows[loop]["SL_NO"].ToString().Split('T');
                        SL_TR_RN    = Convert.ToInt32(saleNoArray[1].ToString());
                        certArray   = dtTransferSaleCert.Rows[loop]["CERTIFICATE"].ToString().Split('-');
                        CertNo      = Convert.ToInt32(certArray[1].ToString());
                        certType    = certArray[0].ToString().ToUpper();


                        commonGatewayObj.Update(htUnitSaleCert, "TRANS_CERT", "F_CD='" + unitRegObj.FundCode.ToString().ToUpper() + "' AND TR_NO=" + SL_TR_RN + "  AND CERT_NO=" + CertNo + " AND CERT_TYPE='" + certType + "'");
                        //  commonGatewayObj.Update(htUnitSaleCert, "SALE_CERT", " REG_BK='" + regObj.FundCode.ToString().ToUpper() + "' AND REG_BR='" + regObj.BranchCode.ToString().ToUpper() + "' AND SL_NO=" + SL_TR_RN + " AND CERT_NO=" + CertNo + " AND CERT_TYPE='" + certType + "'");
                        //   commonGatewayObj.Update(htUnitSaleCert, "RENEWAL_OUT", "REN_NO='" + SL_TR_RN + "' AND REG_BK='" + regObj.FundCode.ToString().ToUpper() + "' AND REG_BR='" + regObj.BranchCode.ToString().ToUpper() + "' AND CERT_NO=" + CertNo + " AND CERT_TYPE='" + certType + "'");

                        Old_SL_TR_RN = "T" + SL_TR_RN.ToString();
                    }
                    else if (dtTransferSaleCert.Rows[loop]["SL_NO"].ToString().ToUpper().IndexOf('R') >= 0)
                    {
                        htUnitSaleCert = new Hashtable();
                        htUnitSaleCert.Add("VALID", valid);
                        htUnitSaleCert.Add("REMARKS", remarks);


                        saleNoArray = dtTransferSaleCert.Rows[loop]["SL_NO"].ToString().Split('R');
                        SL_TR_RN    = Convert.ToInt32(saleNoArray[1].ToString());
                        certArray   = dtTransferSaleCert.Rows[loop]["CERTIFICATE"].ToString().Split('-');
                        CertNo      = Convert.ToInt32(certArray[1].ToString());
                        certType    = certArray[0].ToString().ToUpper();

                        commonGatewayObj.Update(htUnitSaleCert, "RENEWAL_OUT", "REN_NO='" + SL_TR_RN + "' AND REG_BK='" + unitRegObj.FundCode.ToString().ToUpper() + "' AND REG_BR='" + unitRegObj.BranchCode.ToString().ToUpper() + "' AND CERT_NO=" + CertNo + " AND CERT_TYPE='" + certType + "'");

                        Old_SL_TR_RN = "R" + SL_TR_RN.ToString();
                    }

                    htRenewalIN = new Hashtable();
                    htRenewalIN.Add("REG_BK", unitRegObj.FundCode.ToString().ToUpper());
                    htRenewalIN.Add("REG_BR", unitRegObj.BranchCode.ToString().ToUpper());
                    htRenewalIN.Add("REG_NO", Convert.ToInt32(unitRegObj.RegNumber.ToString()));
                    htRenewalIN.Add("REN_NO", renwalObj.RenewalNo.ToString());

                    certArray = dtTransferSaleCert.Rows[loop]["CERTIFICATE"].ToString().Split('-');

                    htRenewalIN.Add("CERT_TYPE", certArray[0].ToString().ToUpper());
                    htRenewalIN.Add("CERT_NO", Convert.ToInt32(certArray[1].ToString()));
                    htRenewalIN.Add("CERTIFICATE", dtTransferSaleCert.Rows[loop]["CERTIFICATE"].ToString().ToUpper());
                    htRenewalIN.Add("QTY", Convert.ToInt32(dtTransferSaleCert.Rows[loop]["QTY"].ToString()));
                    htRenewalIN.Add("SL_TR_NO", Old_SL_TR_RN.ToString().ToUpper());

                    commonGatewayObj.Insert(htRenewalIN, "RENEWAL_IN");
                }

                DataTable dtTransfer = unitTransferBLObj.dtTrnasfer(dtTransferSaleCert);
                for (int i = 0; i < dtTransfer.Rows.Count; i++) //Insert Into Renewal Table
                {
                    htRenwal = new Hashtable();

                    htRenwal.Add("REN_NO", renwalObj.RenewalNo.ToString());
                    htRenwal.Add("REN_DT", Convert.ToDateTime(renwalObj.RenewalDate).ToString("dd-MMM-yyyy"));
                    htRenwal.Add("REG_BK", unitRegObj.FundCode.ToString().ToUpper());
                    htRenwal.Add("REG_BR", unitRegObj.BranchCode.ToString());
                    htRenwal.Add("REG_NO", Convert.ToInt32(unitRegObj.RegNumber.ToString()));
                    htRenwal.Add("FORM_CODE", FORM_CODE);
                    htRenwal.Add("SL_TR_NO", dtTransfer.Rows[i]["SL_NO"].ToString());
                    htRenwal.Add("REN_TYPE", renwalObj.RenewalType.ToString().ToUpper());
                    htRenwal.Add("QTY", Convert.ToInt32(dtTransfer.Rows[i]["QTY"].ToString()));
                    htRenwal.Add("USER_NM", unitUserObj.UserID.ToString());
                    htRenwal.Add("ENT_DT", DateTime.Now.ToString());
                    htRenwal.Add("ENT_TM", DateTime.Now.ToShortTimeString().ToString());
                    commonGatewayObj.Insert(htRenwal, "RENEWAL");
                }

                for (int looper = 0; looper < dtDinomination.Rows.Count; looper++)//Insert Into RenewalOut Table
                {
                    htRenewalOUT = new Hashtable();
                    htRenewalOUT.Add("REG_BK", unitRegObj.FundCode.ToString().ToUpper());
                    htRenewalOUT.Add("REG_BR", unitRegObj.BranchCode.ToString());
                    htRenewalOUT.Add("REG_NO", Convert.ToInt32(unitRegObj.RegNumber.ToString()));
                    htRenewalOUT.Add("REN_NO", renwalObj.RenewalNo.ToString());
                    htRenewalOUT.Add("CERT_TYPE", dtDinomination.Rows[looper]["dino"].ToString().ToUpper());
                    htRenewalOUT.Add("CERT_NO", Convert.ToInt32(dtDinomination.Rows[looper]["cert_no"].ToString()));
                    htRenewalOUT.Add("CERTIFICATE", SaleCertNo(Convert.ToInt32(dtDinomination.Rows[looper]["cert_no"].ToString()), dtDinomination.Rows[looper]["dino"].ToString().ToUpper()));
                    htRenewalOUT.Add("QTY", Convert.ToInt32(dtDinomination.Rows[looper]["cert_weight"].ToString()));

                    commonGatewayObj.Insert(htRenewalOUT, "RENEWAL_OUT");
                }

                commonGatewayObj.CommitTransaction();
            }
            catch (Exception ex)
            {
                commonGatewayObj.RollbackTransaction();
                throw ex;
            }
        }
Esempio n. 29
0
    protected void SubmitButton_Click(object sender, EventArgs e)
    {
        Hashtable htUpdate = new Hashtable();

        try
        {
            bool isDupliacteDRFolioNo       = unitSaleBLObj.CheckDuplicateSaleRelatedInfo(" AND SALE.REG_BK='" + fundCode + "' AND SALE.DRF_REG_FOLIO_NO='" + RegFolioNoTextBox.Text + "'");
            bool isDupliacteDRCertNo        = unitSaleBLObj.CheckDuplicateSaleRelatedInfo(" AND SALE.REG_BK='" + fundCode + "' AND SALE.DRF_CERT_NO ='" + CertNoTextBox.Text + "'");
            bool isDupliacteDRDistinctiveNo = unitSaleBLObj.CheckDuplicateSaleRelatedInfo("AND ((SALE.DRF_DISTNCT_NO_FROM BETWEEN " + DistinctNoFromTextBox.Text.Trim().ToString() + " AND " + DistinctNoToTextBox.Text.Trim().ToString() + ") AND (SALE.REG_BK = '" + fundCode + "') OR (SALE.DRF_DISTNCT_NO_TO BETWEEN " + DistinctNoFromTextBox.Text.Trim().ToString() + " AND " + DistinctNoToTextBox.Text.Trim().ToString() + ") AND (SALE.REG_BK = '" + fundCode + "'))");
            if (isDupliacteDRFolioNo)
            {
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('Save Failed Due to Duplicate Folio number');", true);
            }
            else if (isDupliacteDRCertNo)
            {
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('Save Failed Due to Duplicate Certificate number');", true);
            }
            else if (isDupliacteDRDistinctiveNo)
            {
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('Save Failed Due to Duplicate Distinctive number');", true);
            }
            else if (((Convert.ToInt64(DistinctNoToTextBox.Text.Trim().ToString()) - Convert.ToInt64(DistinctNoFromTextBox.Text.Trim().ToString()) + 1)) != Convert.ToInt64(TotalUnitsTextBox.Text.Trim().ToString()))
            {
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('Save Failed Due to  Distinctive Range and Total Units is not Eqqaul');", true);
            }
            else
            {
                commonGatewayObj.BeginTransaction();

                htUpdate = new Hashtable();
                htUpdate.Add("DRF_CUST_REQ_BY", userObj.UserID.ToString());
                htUpdate.Add("DRF_CUST_REQ_DATE", DateTime.Now);
                htUpdate.Add("DRF_REG_FOLIO_NO", RegFolioNoTextBox.Text.Trim().ToString());
                htUpdate.Add("DRF_CERT_NO", CertNoTextBox.Text.Trim().ToString());
                htUpdate.Add("DRF_DISTNCT_NO_FROM", DistinctNoFromTextBox.Text.Trim().ToString());
                htUpdate.Add("DRF_DISTNCT_NO_TO", DistinctNoToTextBox.Text.Trim().ToString());

                commonGatewayObj.Update(htUpdate, "SALE", "REG_BK='" + fundCode.ToUpper().ToString() + "' AND REG_BR='" + branchCode.ToUpper().ToString() + "' AND SALE.DRF_REF_NO=" + DRRefNoDropDownList.SelectedValue.ToString());

                commonGatewayObj.CommitTransaction();
                DRRefNoDropDownList.DataSource     = unitSaleBLObj.dtDRRefNoListForCustodian("AND SALE.REG_BK='" + fundCode + "'");
                DRRefNoDropDownList.DataTextField  = "NAME";
                DRRefNoDropDownList.DataValueField = "ID";
                DRRefNoDropDownList.DataBind();

                RegFolioNoTextBox.Text     = "";
                CertNoTextBox.Text         = "";
                DistinctNoFromTextBox.Text = "";
                DistinctNoToTextBox.Text   = "";
                TotalUnitsTextBox.Text     = "";
                DataTable dtSaleInfoForDRF = unitSaleBLObj.dtGetSaleInfoForDemate(" AND SALE.REG_BK='" + fundCode + "' AND SALE.REG_BR='" + branchCode + "' AND SALE.DRF_REF_NO=0");
                SaleListGridView.DataSource = dtSaleInfoForDRF;
                SaleListGridView.DataBind();
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert('Save Successfully');", true);
            }
        }
        catch (Exception ex)
        {
            commonGatewayObj.RollbackTransaction();
            ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('Save Failed Due to Error:" + ex.Message.ToString() + "');", true);
        }
    }