Esempio n. 1
0
        public void saveLienMark(DataTable dtTransferSaleCert, UnitHolderRegistration regObj, UnitLien unitLienObj, UnitUser unitUserObj)
        {
            try
            {
                UnitTransferBL unitTransferBLObj = new UnitTransferBL();
                commonGatewayObj.BeginTransaction();
                Hashtable htLienRegInfo = new Hashtable();
                Hashtable htCertNoTemp  = new Hashtable();
                int       SL_TR_RN      = 0;
                int       CertNo        = 0;
                string    certType      = "";
                string[]  saleNoArray;
                string[]  certArray;
                string    statusFlag   = "L";
                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)
                    {
                        htLienRegInfo = new Hashtable();
                        htLienRegInfo.Add("CURR_REG_BK", regObj.FundCode.ToString().ToUpper());
                        htLienRegInfo.Add("CURR_REG_BR", regObj.BranchCode.ToString().ToUpper());
                        htLienRegInfo.Add("CURR_REG_NO", regObj.RegNumber.ToString());
                        htLienRegInfo.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(htLienRegInfo, "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)
                    {
                        htLienRegInfo = new Hashtable();
                        htLienRegInfo.Add("CURR_REG_BK", regObj.FundCode.ToString().ToUpper());
                        htLienRegInfo.Add("CURR_REG_BR", regObj.BranchCode.ToString().ToUpper());
                        htLienRegInfo.Add("CURR_REG_NO", regObj.RegNumber.ToString());
                        htLienRegInfo.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(htLienRegInfo, "TRANS_CERT", "F_CD='" + regObj.FundCode.ToString().ToUpper() + "' AND TR_NO=" + SL_TR_RN + "  AND CERT_NO=" + CertNo + " AND CERT_TYPE='" + certType + "'");
                        //commonGatewayObj.Update(htLienRegInfo, "SALE_CERT", "CERT_NO=" + CertNo + " AND CERT_TYPE='" + certType + "'");
                        //commonGatewayObj.Update(htLienRegInfo, "RENEWAL_OUT", "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)
                    {
                        htLienRegInfo = new Hashtable();
                        htLienRegInfo.Add("CURR_REG_BK", regObj.FundCode.ToString().ToUpper());
                        htLienRegInfo.Add("CURR_REG_BR", regObj.BranchCode.ToString().ToUpper());
                        htLienRegInfo.Add("CURR_REG_NO", regObj.RegNumber.ToString());
                        htLienRegInfo.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(htLienRegInfo, "RENEWAL_OUT", "REG_NO=" + Convert.ToInt32(regObj.RegNumber) + " AND 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 = "R" + SL_TR_RN.ToString();
                    }


                    htLienRegInfo = new Hashtable();
                    htLienRegInfo.Add("REG_BK", regObj.FundCode.ToString().ToUpper());
                    htLienRegInfo.Add("REG_BR", regObj.BranchCode.ToString().ToUpper());
                    htLienRegInfo.Add("REG_NO", regObj.RegNumber.ToString());
                    htLienRegInfo.Add("LIEN_NO", Convert.ToInt32(unitLienObj.LienNo.ToString()));

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

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

                    commonGatewayObj.Insert(htLienRegInfo, "LIEN_MARK_CERT_NO");
                }



                DataTable dtTransfer = unitTransferBLObj.dtTrnasfer(dtTransferSaleCert);
                for (int i = 0; i < dtTransfer.Rows.Count; i++)
                {
                    htLienRegInfo = new Hashtable();
                    htLienRegInfo.Add("LIEN_NO", Convert.ToInt32(unitLienObj.LienNo.ToString()));
                    htLienRegInfo.Add("LIEN_DT", Convert.ToDateTime(unitLienObj.LienReqDate.ToString()).ToString("dd-MMM-yyyy"));
                    htLienRegInfo.Add("LN_REQ_REF", unitLienObj.LienRefference.ToString());
                    htLienRegInfo.Add("LN_BK_CODE", Convert.ToInt16(unitLienObj.LienInst.ToString()));
                    htLienRegInfo.Add("LN_BK_BR_CODE", Convert.ToInt16(unitLienObj.LienInstBranch.ToString()));


                    htLienRegInfo.Add("SL_TR_NO", dtTransfer.Rows[i]["SL_NO"].ToString());
                    htLienRegInfo.Add("REG_BK", regObj.FundCode.ToString().ToUpper());
                    htLienRegInfo.Add("REG_BR", regObj.BranchCode.ToString().ToUpper());
                    htLienRegInfo.Add("REG_NO", regObj.RegNumber.ToString());
                    htLienRegInfo.Add("QTY", Convert.ToInt32(dtTransfer.Rows[i]["QTY"].ToString()));

                    htLienRegInfo.Add("USER_NM", unitUserObj.UserID.ToString());
                    htLienRegInfo.Add("ENT_DT", DateTime.Now.ToString());
                    htLienRegInfo.Add("ENT_TM", DateTime.Now.ToShortTimeString().ToString());

                    commonGatewayObj.Insert(htLienRegInfo, "LIEN_MARK");
                }
                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. 3
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;
            }
        }