Пример #1
0
    protected void SaveButton_Click(object sender, EventArgs e)
    {
        UnitHolderRegistration regObj      = new UnitHolderRegistration();
        UnitTransfer           transferObj = new UnitTransfer();

        regObj.FundCode   = tfereeFundCodeTextBox.Text.Trim();
        regObj.BranchCode = tfereeBranhCodeTextBox.Text.Trim();
        regObj.RegNumber  = tferorRegNoTextBox.Text.Trim();

        transferObj.TransferNo       = Convert.ToInt32(transferNoTextBox.Text.Trim());
        transferObj.TransferDate     = transferDateTextBox.Text.Trim().ToString();
        transferObj.TransferorRegNo  = tferorRegNoTextBox.Text.Trim().ToString();
        transferObj.TferorBranchCode = tferorBranchCodeTextBox.Text.Trim().ToString();
        transferObj.TransfereeRegNo  = tfereeRegNoTextBox.Text.Trim().ToString();
        transferObj.TfereeBranchCode = tfereeBranhCodeTextBox.Text.Trim().ToString();

        try
        {
            if (unitTransferBLObj.IsTransferLock(regObj))
            {
                dvContentBottom.Visible = true;
                transferNoTextBox.Focus();
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert('" + msgObj.Error().ToString() + " " + "Transfer Opearation is Locked " + "');", true);
            }
            else if (unitTransferBLObj.IsDuplicateTransfer(regObj, transferObj))
            {
                dvContentBottom.Visible = true;
                transferNoTextBox.Focus();
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert('" + msgObj.Duplicate().ToString() + " " + "Transfer Number " + "');", true);
            }
            else
            {
                DataTable dtGrid = opendMFDAO.getTableDataGrid();
                DataRow   drGrid;
                foreach (DataGridItem gridRow in leftDataGrid.Items)
                {
                    CheckBox leftCheckBox = (CheckBox)gridRow.FindControl("leftCheckBox");
                    if (leftCheckBox.Checked)
                    {
                        drGrid                = dtGrid.NewRow();
                        drGrid["SL_NO"]       = gridRow.Cells[1].Text.Trim().ToString();
                        drGrid["CERTIFICATE"] = gridRow.Cells[2].Text.Trim().ToString();
                        drGrid["QTY"]         = gridRow.Cells[3].Text.Trim().ToString();
                        dtGrid.Rows.Add(drGrid);
                    }
                }

                unitTransferBLObj.saveTransfer(dtGrid, regObj, transferObj, userObj); //save Transfer Data
                ClearText();
                leftDataGrid.DataSource = opendMFDAO.getTableDataGrid();              // hide remaining Data
                leftDataGrid.DataBind();
                tferorRegNoTextBox.Focus();
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('Save SuccessFully');", true);
            }
        }
        catch (Exception ex)
        {
            ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Popup", "alert ('" + msgObj.Error().ToString() + " " + ex.Message.Replace("'", "").ToString() + "');", true);
        }
    }
Пример #2
0
        public bool IsDuplicateTransfer(UnitHolderRegistration regObj, UnitTransfer transferObj)
        {
            DataTable dtTransfer = new DataTable();

            dtTransfer = commonGatewayObj.Select("SELECT * FROM TRANSFER WHERE  F_CD='" + regObj.FundCode.ToString().ToUpper() + "'AND BR_CODE='" + regObj.FundCode.ToString().ToUpper() + "_" + regObj.BranchCode.ToString() + "' AND TR_NO=" + Convert.ToInt32(transferObj.TransferNo.ToString()));
            if (dtTransfer.Rows.Count > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #3
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;
            }
        }
Пример #4
0
        public void saveTransferCDS(DataTable dtSaleTrInfo, UnitHolderRegistration regObj, UnitTransfer transferObj, UnitUser unitUserObj)
        {
            try
            {
                commonGatewayObj.BeginTransaction();
                Hashtable htTransferRegInfo = new Hashtable();

                StringBuilder sbQuery = new StringBuilder();
                string[]      saleNoArray;
                for (int loop = 0; loop < dtSaleTrInfo.Rows.Count; loop++)
                {
                    if (dtSaleTrInfo.Rows[loop]["SL_TR_NO"].ToString().ToUpper().IndexOf('S') >= 0)
                    {
                        saleNoArray = dtSaleTrInfo.Rows[loop]["SL_TR_NO"].ToString().Split('S');
                        sbQuery.Append("UPDATE SALE SET QTY_OUT=NVL(QTY_OUT,0)+" + Convert.ToInt64(dtSaleTrInfo.Rows[loop]["SURRENDER_UNITS"].ToString()));
                        sbQuery.Append(" WHERE REG_BK='" + regObj.FundCode.ToString().ToUpper() + "' AND REG_BR='" + regObj.BranchCode.ToString().ToUpper() + "'");
                        sbQuery.Append(" AND REG_NO=" + Convert.ToInt32(regObj.RegNumber.ToString()) + " AND SL_NO=" + Convert.ToInt32(saleNoArray[1].ToString()));

                        commonGatewayObj.ExecuteNonQuery(sbQuery.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()));
                        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(dtSaleTrInfo.Rows[loop]["SURRENDER_UNITS"].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", dtSaleTrInfo.Rows[loop]["SL_TR_NO"].ToString());
                        commonGatewayObj.Insert(htTransferRegInfo, "TRANSFER");
                    }
                    else if (dtSaleTrInfo.Rows[loop]["SL_TR_NO"].ToString().ToUpper().IndexOf('T') >= 0)
                    {
                        saleNoArray = dtSaleTrInfo.Rows[loop]["SL_TR_NO"].ToString().Split('T');
                        sbQuery.Append("UPDATE TRANSFER SET QTY_OUT=NVL(QTY_OUT,0)+" + Convert.ToInt64(dtSaleTrInfo.Rows[loop]["SURRENDER_UNITS"].ToString()));
                        sbQuery.Append(" WHERE F_CD='" + regObj.FundCode.ToString().ToUpper() + "' AND BR_CODE='" + regObj.FundCode.ToString() + "_" + regObj.BranchCode.ToString().ToUpper() + "'");
                        sbQuery.Append(" AND REG_NO_I=" + Convert.ToInt32(regObj.RegNumber.ToString()) + "AND TR_NO=" + Convert.ToInt32(saleNoArray[1].ToString()));

                        commonGatewayObj.ExecuteNonQuery(sbQuery.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()));
                        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(dtSaleTrInfo.Rows[loop]["SURRENDER_UNITS"].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", dtSaleTrInfo.Rows[loop]["SL_TR_NO"].ToString());
                        commonGatewayObj.Insert(htTransferRegInfo, "TRANSFER");
                    }
                }



                commonGatewayObj.CommitTransaction();
            }
            catch (Exception ex)
            {
                commonGatewayObj.RollbackTransaction();
                throw ex;
            }
        }