private bool MFWERPSIPTransactionInsertion(int UploadProcessId)
        {
            bool blResult = false;

            processlogVo    = new UploadProcessLogVo();
            uploadsCommonBo = new UploadCommonBo();
            CamsUploadsBo camsUploadsBo              = new CamsUploadsBo();
            bool          camsSIPCommonStagingChk    = false;
            bool          camsSIPCommonStagingToWERP = false;
            bool          updateProcessLog           = false;
            string        packagePath;
            string        fileType = "CA";


            processlogVo = uploadsCommonBo.GetProcessLogInfo(UploadProcessId);
            if (processlogVo.FileTypeId == 20)
            {
                fileType = "CA";
            }
            else if (processlogVo.FileTypeId == 26)
            {
                fileType = "WPT";
            }
            else if (processlogVo.FileTypeId == 27)
            {
                fileType = "KA";
            }
            packagePath = Server.MapPath("\\UploadPackages\\CAMSSystematicUploadPackageNew\\CAMSSystematicUploadPackageNew\\UploadSIPCommonStagingCheck.dtsx");

            camsSIPCommonStagingChk = camsUploadsBo.CamsSIPCommonStagingChk(UploadProcessId, packagePath, configPath, fileType);
            processlogVo.NoOfTransactionInserted = uploadsCommonBo.GetUploadSystematicInsertCount(UploadProcessId, fileType);

            updateProcessLog = uploadsCommonBo.UpdateUploadProcessLog(processlogVo);
            if (camsSIPCommonStagingChk)
            {
                packagePath = Server.MapPath("\\UploadPackages\\CAMSSystematicUploadPackageNew\\CAMSSystematicUploadPackageNew\\UploadSIPCommonStagingToWERP.dtsx");
                camsSIPCommonStagingToWERP = camsUploadsBo.CamsSIPCommonStagingToWERP(UploadProcessId, packagePath, configPath);

                if (camsSIPCommonStagingToWERP)
                {
                    processlogVo.IsInsertionToWERPComplete = 1;
                    processlogVo.EndTime             = DateTime.Now;
                    processlogVo.NoOfRejectedRecords = uploadsCommonBo.GetUploadSystematicRejectCount(UploadProcessId, fileType);
                    blResult = uploadsCommonBo.UpdateUploadProcessLog(processlogVo);
                }
            }
            return(blResult);
        }
예제 #2
0
        private bool MFWERPTransactionWERPInsertion(int ProcessId, out int countTransactionsInserted, out int countRejectedRecords)
        {
            bool blResult = false;

            processlogVo    = new UploadProcessLogVo();
            uploadsCommonBo = new UploadCommonBo();
            werpUploadBo    = new WerpUploadsBo();

            countTransactionsInserted = 0;
            countRejectedRecords      = 0;

            processlogVo = uploadsCommonBo.GetProcessLogInfo(ProcessId);

            // WERP Insertion
            // WERP Equity Transation Insertion
            WerpEQUploadsBo werpEQUploadsBo = new WerpEQUploadsBo();
            string          packagePath     = Server.MapPath("\\UploadPackages\\EQTransactionUploadPackage\\EQTransactionUploadPackage\\EQTransactionUploadPackage\\UploadChecksOnEQTranStaging.dtsx");
            bool            WERPEQSecondStagingCheckResult = werpEQUploadsBo.WERPEQProcessDataInSecondStagingTrans(ProcessId, packagePath, configPath, adviserVo.advisorId);

            if (WERPEQSecondStagingCheckResult)
            {
                packagePath = Server.MapPath("\\UploadPackages\\EQTransactionUploadPackage\\EQTransactionUploadPackage\\EQTransactionUploadPackage\\UploadEQTranStagingToWerp.dtsx");
                bool WERPEQTranWerpResult = werpEQUploadsBo.WERPEQInsertTransDetails(ProcessId, packagePath, configPath); // EQ Trans XML File Type Id = 8);
                if (WERPEQTranWerpResult)
                {
                    processlogVo.IsInsertionToWERPComplete = 1;
                    processlogVo.NoOfTransactionInserted   = uploadsCommonBo.GetTransUploadCount(ProcessId, "WPEQ");
                    processlogVo.NoOfRejectedRecords       = uploadsCommonBo.GetTransUploadRejectCount(ProcessId, "WPEQ");
                    processlogVo.EndTime = DateTime.Now;
                    blResult             = uploadsCommonBo.UpdateUploadProcessLog(processlogVo);
                }
            }
            return(blResult);
        }
예제 #3
0
        public bool MFTrailTransactionInsertion(int UploadProcessId)
        {
            bool blResult = false;

            uploadProcessLogVo = new UploadProcessLogVo();
            uploadsCommonBo    = new UploadCommonBo();
            CamsUploadsBo camsUploadsBo = new CamsUploadsBo();
            bool          TempletonTrailCommonStagingChk     = false;
            bool          TempletonTrailCommonStagingToSetUp = false;
            bool          updateProcessLog = false;
            string        packagePath;


            uploadProcessLogVo = uploadsCommonBo.GetProcessLogInfo(UploadProcessId);

            packagePath = Server.MapPath("\\UploadPackages\\TrailCommisionUploadPackage\\TrailCommissionUpload\\TrailCommissionUpload\\callOnReprocess.dtsx");

            TempletonTrailCommonStagingChk             = uploadsCommonBo.TrailCommissionCommonStagingCheck(adviserId, UploadProcessId, packagePath, configPath);
            uploadProcessLogVo.NoOfTransactionInserted = uploadsCommonBo.GetUploadSystematicInsertCount(UploadProcessId, "TN");

            updateProcessLog = uploadsCommonBo.UpdateUploadProcessLog(uploadProcessLogVo);
            if (TempletonTrailCommonStagingChk)
            {
                packagePath = Server.MapPath("\\UploadPackages\\TrailCommisionUploadPackage\\TrailCommissionUpload\\TrailCommissionUpload\\commonStagingToTrailSetUp.dtsx");
                //TempletonTrailCommonStagingToSetUp = camsUploadsBo.CamsSIPCommonStagingToWERP(UploadProcessId, packagePath, configPath);
                TempletonTrailCommonStagingToSetUp = camsUploadsBo.TempletonTrailCommissionCommonStagingChk(UploadProcessId, packagePath, configPath, "TN", adviserId);


                if (TempletonTrailCommonStagingToSetUp)
                {
                    uploadProcessLogVo.IsInsertionToWERPComplete = 1;
                    uploadProcessLogVo.EndTime             = DateTime.Now;
                    uploadProcessLogVo.NoOfRejectedRecords = uploadsCommonBo.GetUploadSystematicRejectCount(UploadProcessId, "TN");
                    blResult = uploadsCommonBo.UpdateUploadProcessLog(uploadProcessLogVo);
                }
            }
            return(blResult);
        }
예제 #4
0
        private bool MFWERPProfileWERPInsertion(int ProcessId, out int countCustCreated, out int countFolioCreated, out int countRejectedRecords)
        {
            bool blResult = false;

            werpMFUploadsBo = new WerpMFUploadsBo();
            processlogVo    = new UploadProcessLogVo();
            uploadsCommonBo = new UploadCommonBo();

            countCustCreated     = 0;
            countFolioCreated    = 0;
            countRejectedRecords = 0;

            processlogVo = uploadsCommonBo.GetProcessLogInfo(ProcessId);

            // Doing a check on data in Staging and marking IsRejected flag
            string packagePath = Server.MapPath("\\UploadPackages\\WerpMFProfileUploadPackageNew\\WerpMFProfileUploadPackageNew\\UploadChecksWerpMFProfileStaging.dtsx");
            bool   werpMFProStagingCheckResult = werpMFUploadsBo.WerpMFProcessDataInStagingProfile(ProcessId, adviserVo.advisorId, packagePath, configPath);

            // Insert Customer Details into Customer Tables
            bool werpMFProCreateCustomerResult    = werpMFUploadsBo.WerpMFInsertCustomerDetails(adviserVo.advisorId, ProcessId, rmVo.RMId, out countCustCreated, out countFolioCreated);
            bool werpMFProCreateBankAccountResult = false;

            if (werpMFProCreateCustomerResult)
            {
                processlogVo.NoOfCustomerInserted += countCustCreated;
                processlogVo.NoOfAccountsInserted += countFolioCreated;
                //countRejectedRecords = uploadsCommonBo.GetProfileUploadRejectCount(ProcessId, Contants.UploadExternalTypeWerp);
                processlogVo.NoOfRejectedRecords = countRejectedRecords;

                // Insert Bank Account Details
                packagePath = Server.MapPath("\\UploadPackages\\WerpMFProfileUploadPackageNew\\WerpMFProfileUploadPackageNew\\UploadWerpMFProfileNewBankAccountCreation.dtsx");
                werpMFProCreateBankAccountResult = werpMFUploadsBo.WerpMFCreationOfNewBankAccounts(ProcessId, packagePath, configPath);
                if (werpMFProCreateBankAccountResult)
                {
                    processlogVo.IsInsertionToWERPComplete  = 1;
                    processlogVo.IsInsertionToXtrnlComplete = 2;
                    processlogVo.EndTime = DateTime.Now;
                    bool updateProcessLog = uploadsCommonBo.UpdateUploadProcessLog(processlogVo);

                    if (updateProcessLog)
                    {
                        blResult = true;
                    }
                }
            }

            return(blResult);
        }
예제 #5
0
        private bool TradeAccountStagingInsertion(int ProcessId, out int countTransactionsInserted, out int countRejectedRecords)
        {
            bool blResult = false;

            processlogVo    = new UploadProcessLogVo();
            uploadsCommonBo = new UploadCommonBo();
            werpUploadBo    = new WerpUploadsBo();

            countTransactionsInserted = 0;
            countRejectedRecords      = 0;

            processlogVo = uploadsCommonBo.GetProcessLogInfo(ProcessId);
            WerpEQUploadsBo werpEQUploadsBo = new WerpEQUploadsBo();
            // WERP Insertion
            string packagePath = Server.MapPath("\\UploadPackages\\EQTradeAccountUploadPackage\\EQTradeAccountUploadPackage\\EQTradeAccountUploadPackage\\UploadChecksOnEQTradeStaging.dtsx");
            bool   WERPEQSecondStagingCheckResult = werpEQUploadsBo.WERPEQProcessDataInSecondStagingTradeAccount(ProcessId, packagePath, configPath, adviserVo.advisorId);

            if (WERPEQSecondStagingCheckResult)
            {
                packagePath = Server.MapPath("\\UploadPackages\\EQTradeAccountUploadPackage\\EQTradeAccountUploadPackage\\EQTradeAccountUploadPackage\\UploadEQTradeStagingToWerp.dtsx");
                bool WERPEQTradeWerpResult = werpEQUploadsBo.WERPEQInsertTradeAccountDetails(ProcessId, packagePath, configPath);

                if (WERPEQTradeWerpResult)
                {
                    processlogVo.IsInsertionToWERPComplete = 1;
                    processlogVo.NoOfAccountsInserted      = uploadsCommonBo.GetAccountsUploadCount(ProcessId, "WPEQ");
                    processlogVo.NoOfRejectedRecords       = uploadsCommonBo.GetAccountsUploadRejectCount(ProcessId, "WPEQ");
                    processlogVo.EndTime = DateTime.Now;
                    bool updateProcessLog = uploadsCommonBo.UpdateUploadProcessLog(processlogVo);

                    if (updateProcessLog)
                    {
                        blResult = true;
                    }
                }
            }

            return(blResult);
        }
        private bool MFWERPTransactionWERPInsertion(int ProcessId, out int countTransactionsInserted, out int countRejectedRecords, int fileTypeId)
        {
            bool blResult = false;

            processlogVo    = new UploadProcessLogVo();
            uploadsCommonBo = new UploadCommonBo();
            werpUploadBo    = new WerpUploadsBo();

            countTransactionsInserted = 0;
            countRejectedRecords      = 0;

            processlogVo = uploadsCommonBo.GetProcessLogInfo(ProcessId);

            //CAMS and KARVY Reprocess
            string packagePath       = Server.MapPath("\\UploadPackages\\MFTransactionCommonUploadPackage\\MFTransactionCommonUploadPackage\\MFTransactionCommonUploadPackage\\ChecksCommonUploadPackage.dtsx");
            bool   CommonTransChecks = false;

            if (fileTypeId == 1)
            {
                bool camsDatatranslationCheckResult = uploadsCommonBo.UploadsCAMSDataTranslationForReprocess(ProcessId);
                if (camsDatatranslationCheckResult)
                {
                    CommonTransChecks = uploadsCommonBo.TransCommonChecks(adviserVo.advisorId, ProcessId, packagePath, configPath, "CA", "CAMS");
                }
            }
            else if (fileTypeId == 3)
            {
                bool karvyDataTranslationCheck = uploadsCommonBo.UploadsKarvyDataTranslationForReprocess(ProcessId);
                if (karvyDataTranslationCheck)
                {
                    CommonTransChecks = uploadsCommonBo.TransCommonChecks(adviserVo.advisorId, ProcessId, packagePath, configPath, "KA", "Karvy");
                }
            }
            else if (fileTypeId == 15)
            {
                bool TempletonDataTranslationCheck = uploadsCommonBo.UploadsTempletonDataTranslationForReprocess(ProcessId);
                if (TempletonDataTranslationCheck)
                {
                    CommonTransChecks = uploadsCommonBo.TransCommonChecks(adviserVo.advisorId, ProcessId, packagePath, configPath, "TN", "Templeton");
                }
            }
            else if (fileTypeId == 17)
            {
                bool DeutscheDataTranslationCheck = uploadsCommonBo.UploadsDeutscheDataTranslationForReprocess(ProcessId);
                if (DeutscheDataTranslationCheck)
                {
                    CommonTransChecks = uploadsCommonBo.TransCommonChecks(adviserVo.advisorId, ProcessId, packagePath, configPath, "DT", "Deutsche");
                }
            }


            if (CommonTransChecks)
            {
                packagePath = Server.MapPath("\\UploadPackages\\MFTransactionCommonUploadPackage\\MFTransactionCommonUploadPackage\\MFTransactionCommonUploadPackage\\InsertTransactionIntoWERP.dtsx");
                bool insertTransWERP = uploadsCommonBo.InsertTransToWERP(ProcessId, packagePath, configPath);
                if (insertTransWERP)
                {
                    processlogVo.IsInsertionToWERPComplete = 1;
                    processlogVo.NoOfTransactionInserted   = uploadsCommonBo.GetTransUploadCount(ProcessId, "WPMF");

                    processlogVo.EndTime = DateTime.Now;

                    if (fileTypeId == 1)
                    {
                        processlogVo.NoOfRejectedRecords = uploadsCommonBo.GetTransUploadRejectCount(ProcessId, Contants.UploadExternalTypeCAMS);
                    }
                    else if (fileTypeId == 3)
                    {
                        processlogVo.NoOfRejectedRecords = uploadsCommonBo.GetTransUploadRejectCount(ProcessId, Contants.UploadExternalTypeKarvy);
                    }
                    else if (fileTypeId == 15)
                    {
                        processlogVo.NoOfRejectedRecords = uploadsCommonBo.GetTransUploadRejectCount(ProcessId, Contants.UploadExternalTypeTemp);
                    }
                    else if (fileTypeId == 17)
                    {
                        processlogVo.NoOfRejectedRecords = uploadsCommonBo.GetTransUploadRejectCount(ProcessId, Contants.UploadExternalTypeDeutsche);
                    }
                    blResult = uploadsCommonBo.UpdateUploadProcessLog(processlogVo);
                }
            }
            return(blResult);
        }
        protected void btnReprocess_Click(object sender, EventArgs e)
        {
            bool blResult = false;

            uploadsCommonBo = new UploadCommonBo();
            xmlPath         = Server.MapPath(ConfigurationManager.AppSettings["xmllookuppath"]).ToString();
            string error                 = "";
            int    countCustCreated      = 0;
            int    countFolioCreated     = 0;
            int    countRejectedRecords  = 0;
            int    processIdReprocessAll = 0;
            string strErrorDesc          = "Please a select a processId";

            DropDownList ddl = (DropDownList)gvWERPProfileReject.HeaderRow.Cells[0].FindControl("ddlProcessId");
            string       val = ddl.SelectedValue;

            if (val == "Select")
            {
                Response.Write(@"<script language='javascript'>alert('The following errors have occurred: \n" + strErrorDesc + " .');</script>");
            }


            else
            {
                ProcessId = Convert.ToInt32(val);
                if (Request.QueryString["filetypeid"] != null)
                {
                    filetypeId = Int32.Parse(Request.QueryString["filetypeid"].ToString());
                }
                if (Request.QueryString["processId"] != null)
                {
                    ProcessId    = Int32.Parse(Request.QueryString["processId"].ToString());
                    processlogVo = uploadsCommonBo.GetProcessLogInfo(ProcessId);
                    if (processlogVo.FileTypeId == 7)
                    {
                        source = "WP";
                    }
                    else if (processlogVo.FileTypeId == 4)
                    {
                        source = "KA";
                    }
                    else if (processlogVo.FileTypeId == 2)
                    {
                        source = "CA";
                    }
                    else if (processlogVo.FileTypeId == 16)
                    {
                        source = "TN";
                    }
                    else if (processlogVo.FileTypeId == 18)
                    {
                        source = "DT";
                    }
                    else if (processlogVo.FileTypeId == 21)
                    {
                        source = "SU";
                    }
                    if (processlogVo.FileTypeId == 7 || processlogVo.FileTypeId == 4 || processlogVo.FileTypeId == 2 || processlogVo.FileTypeId == 16 || processlogVo.FileTypeId == 18 || processlogVo.FileTypeId == 21)
                    {
                        StandardProfileUploadBo standardProfileUploadBo = new StandardProfileUploadBo();
                        //Checks in Profile Staging
                        string packagePath = Server.MapPath("\\UploadPackages\\StandardProfileUploadPackageNew\\StandardProfileUploadPackageNew\\UploadsCommonProfileChecksInProfileStaging.dtsx");
                        bool   karvyProCommonChecksResult = standardProfileUploadBo.StdCommonProfileChecks(ProcessId, processlogVo.AdviserId, packagePath, configPath);
                        if (karvyProCommonChecksResult)
                        {
                            // Insert Customer Details into WERP Tables

                            bool stdProCreateCustomerResult = standardProfileUploadBo.StdInsertCustomerDetails(processlogVo.AdviserId, ProcessId, processlogVo.RmId, processlogVo.BranchId, xmlPath, out countCustCreated);
                            if (stdProCreateCustomerResult)
                            {
                                //Create new Bank Accounts
                                packagePath = Server.MapPath("\\UploadPackages\\StandardProfileUploadPackageNew\\StandardProfileUploadPackageNew\\UploadCreateNewBankAccount.dtsx");
                                bool stdProCreateBankAccountResult = standardProfileUploadBo.StdCreationOfNewBankAccounts(ProcessId, packagePath, configPath, adviserVo.advisorId);
                                if (stdProCreateBankAccountResult)
                                {
                                    processlogVo.IsInsertionToWERPComplete = 1;
                                    processlogVo.EndTime                = DateTime.Now;
                                    processlogVo.NoOfRejectedRecords    = uploadsCommonBo.GetUploadProfileRejectCount(ProcessId, source);
                                    processlogVo.NoOfCustomerInserted   = processlogVo.NoOfCustomerInserted + countCustCreated;
                                    processlogVo.NoOfCustomerDuplicates = processlogVo.NoOfTotalRecords - processlogVo.NoOfCustomerInserted - processlogVo.NoOfRejectedRecords;
                                    processlogVo.NoOfInputRejects       = uploadsCommonBo.GetUploadProfileInputRejectCount(ProcessId, source);
                                    blResult = uploadsCommonBo.UpdateUploadProcessLog(processlogVo);
                                    if (blResult)
                                    {
                                        bool stdProCommonDeleteResult = standardProfileUploadBo.StdDeleteCommonStaging(ProcessId);
                                    }
                                }
                            }
                        }
                    }
                }

                else
                {
                    DataSet ds = uploadsCommonBo.GetWERPUploadDetailsForProcessId(ProcessId);
                    //DataSet ds = uploadsCommonBo.GetWERPUploadProcessId();
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        rmId                  = int.Parse(dr["AR_RMId"].ToString());
                        adviserId             = int.Parse(dr["A_AdviserId"].ToString());
                        processIdReprocessAll = ProcessId;
                        processlogVo          = uploadsCommonBo.GetProcessLogInfo(processIdReprocessAll);
                        if (processlogVo.FileTypeId == 7)
                        {
                            source = "WP";
                        }
                        else if (processlogVo.FileTypeId == 4)
                        {
                            source = "KA";
                        }
                        else if (processlogVo.FileTypeId == 2)
                        {
                            source = "CA";
                        }
                        else if (processlogVo.FileTypeId == 16)
                        {
                            source = "TN";
                        }
                        else if (processlogVo.FileTypeId == 18)
                        {
                            source = "DT";
                        }
                        else if (processlogVo.FileTypeId == 21)
                        {
                            source = "SU";
                        }

                        if (processlogVo.FileTypeId == 7 || processlogVo.FileTypeId == 4 || processlogVo.FileTypeId == 2 || processlogVo.FileTypeId == 16 || processlogVo.FileTypeId == 18 || processlogVo.FileTypeId == 21)
                        {
                            StandardProfileUploadBo standardProfileUploadBo = new StandardProfileUploadBo();
                            //Checks in Profile Staging
                            string packagePath = Server.MapPath("\\UploadPackages\\StandardProfileUploadPackageNew\\StandardProfileUploadPackageNew\\UploadsCommonProfileChecksInProfileStaging.dtsx");
                            bool   karvyProCommonChecksResult = standardProfileUploadBo.StdCommonProfileChecks(processIdReprocessAll, adviserId, packagePath, configPath);
                            if (karvyProCommonChecksResult)
                            {
                                // Insert Customer Details into WERP Tables

                                bool stdProCreateCustomerResult = standardProfileUploadBo.StdInsertCustomerDetails(adviserId, processIdReprocessAll, rmId, processlogVo.BranchId, xmlPath, out countCustCreated);
                                if (stdProCreateCustomerResult)
                                {
                                    //Create new Bank Accounts
                                    packagePath = Server.MapPath("\\UploadPackages\\StandardProfileUploadPackageNew\\StandardProfileUploadPackageNew\\UploadCreateNewBankAccount.dtsx");
                                    bool stdProCreateBankAccountResult = standardProfileUploadBo.StdCreationOfNewBankAccounts(processIdReprocessAll, packagePath, configPath, adviserVo.advisorId);
                                    if (stdProCreateBankAccountResult)
                                    {
                                        processlogVo.IsInsertionToWERPComplete = 1;
                                        processlogVo.EndTime                = DateTime.Now;
                                        processlogVo.NoOfRejectedRecords    = uploadsCommonBo.GetUploadProfileRejectCount(processIdReprocessAll, source);
                                        processlogVo.NoOfCustomerInserted   = processlogVo.NoOfCustomerInserted + countCustCreated;
                                        processlogVo.NoOfCustomerDuplicates = processlogVo.NoOfTotalRecords - processlogVo.NoOfCustomerInserted - processlogVo.NoOfRejectedRecords;
                                        processlogVo.NoOfInputRejects       = uploadsCommonBo.GetUploadProfileInputRejectCount(processIdReprocessAll, source);
                                        blResult = uploadsCommonBo.UpdateUploadProcessLog(processlogVo);
                                        if (blResult)
                                        {
                                            bool stdProCommonDeleteResult = standardProfileUploadBo.StdDeleteCommonStaging(processIdReprocessAll);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }

                if (blResult == false)
                {
                    error = error + "Error when reprocessing for the processid:" + processIdReprocessAll + ";";
                }
                if (blResult)
                {
                    // Success Message
                    //trErrorMessage.Visible = true;
                    //lblError.Text = "Reprocess Done Successfully!";
                    msgReprocessComplete.Visible = true;
                }
                else
                {
                    // Failure Message
                    msgReprocessincomplete.Visible = true;
                }

                BindWerpProfileGrid(ProcessId);
            }
        }
예제 #8
0
        protected void btnReprocess_Click(object sender, EventArgs e)
        {
            bool blResult = false;

            uploadsCommonBo = new UploadCommonBo();
            xmlPath         = Server.MapPath(ConfigurationManager.AppSettings["xmllookuppath"]).ToString();

            int countCustCreated     = 0;
            int countFolioCreated    = 0;
            int countRejectedRecords = 0;

            processlogVo = uploadsCommonBo.GetProcessLogInfo(ProcessId);
            if (processlogVo.FileTypeId == 7)
            {
                source = "WP";
            }
            else if (processlogVo.FileTypeId == 4)
            {
                source = "KA";
            }
            else if (processlogVo.FileTypeId == 2)
            {
                source = "CA";
            }
            else if (processlogVo.FileTypeId == 16)
            {
                source = "TN";
            }
            else if (processlogVo.FileTypeId == 18)
            {
                source = "DT";
            }

            // BindGrid
            if (Request.QueryString["processId"] != null)
            {
                ProcessId = Int32.Parse(Request.QueryString["processId"].ToString());
            }
            if (Request.QueryString["filetypeid"] != null)
            {
                filetypeId = Int32.Parse(Request.QueryString["filetypeid"].ToString());
            }


            StandardProfileUploadBo standardProfileUploadBo = new StandardProfileUploadBo();
            //Checks in Profile Staging
            string packagePath = Server.MapPath("\\UploadPackages\\StandardProfileUploadPackageNew\\StandardProfileUploadPackageNew\\UploadsCommonProfileChecksInProfileStaging.dtsx");
            bool   karvyProCommonChecksResult = standardProfileUploadBo.StdCommonProfileChecks(ProcessId, adviserVo.advisorId, packagePath, configPath);

            if (karvyProCommonChecksResult)
            {
                // Insert Customer Details into WERP Tables

                bool stdProCreateCustomerResult = standardProfileUploadBo.StdInsertCustomerDetails(adviserVo.advisorId, ProcessId, rmVo.RMId, processlogVo.BranchId, xmlPath, out countCustCreated);
                if (stdProCreateCustomerResult)
                {
                    //Create new Bank Accounts
                    packagePath = Server.MapPath("\\UploadPackages\\StandardProfileUploadPackageNew\\StandardProfileUploadPackageNew\\UploadCreateNewBankAccount.dtsx");
                    bool stdProCreateBankAccountResult = standardProfileUploadBo.StdCreationOfNewBankAccounts(ProcessId, packagePath, configPath);
                    if (stdProCreateBankAccountResult)
                    {
                        processlogVo.IsInsertionToWERPComplete = 1;
                        processlogVo.EndTime                = DateTime.Now;
                        processlogVo.NoOfRejectedRecords    = uploadsCommonBo.GetUploadProfileRejectCount(ProcessId, source);
                        processlogVo.NoOfCustomerInserted   = processlogVo.NoOfCustomerInserted + countCustCreated;
                        processlogVo.NoOfCustomerDuplicates = processlogVo.NoOfTotalRecords - processlogVo.NoOfCustomerInserted - processlogVo.NoOfRejectedRecords;
                        processlogVo.NoOfInputRejects       = uploadsCommonBo.GetUploadProfileInputRejectCount(ProcessId, source);
                        blResult = uploadsCommonBo.UpdateUploadProcessLog(processlogVo);
                        if (blResult)
                        {
                            bool stdProCommonDeleteResult = standardProfileUploadBo.StdDeleteCommonStaging(ProcessId);
                        }
                    }
                }
            }


            if (blResult)
            {
                // Success Message
                //trErrorMessage.Visible = true;
                //lblError.Text = "Reprocess Done Successfully!";
                msgReprocessComplete.Visible = true;
            }
            else
            {
                // Failure Message
                msgReprocessincomplete.Visible = true;
            }

            BindWerpProfileGrid(ProcessId);
        }
        protected void btnReprocess_Click(object sender, EventArgs e)
        {
            bool                    blResult                = false;
            UploadCommonBo          uploadsCommonBo         = new UploadCommonBo();
            UploadProcessLogVo      processlogVo            = new UploadProcessLogVo();
            UploadProcessLogVo      TempprocesslogVo        = new UploadProcessLogVo();
            StandardProfileUploadBo standardProfileUploadBo = new StandardProfileUploadBo();
            StandardFolioUploadBo   standardFolioUploadBo   = new StandardFolioUploadBo();
            CamsUploadsBo           camsUploadsBo           = new CamsUploadsBo();
            int countCustCreated = 0;

            //int countFolioCreated = 0;
            //int countRejectedRecords = 0;

            // processlogVo = uploadsCommonBo.GetProcessLogInfo(ProcessId);


            // BindGrid
            if (Request.QueryString["processId"] != null)
            {
                ProcessId = Int32.Parse(Request.QueryString["processId"].ToString());
            }
            if (Request.QueryString["filetypeid"] != null)
            {
                filetypeId = Int32.Parse(Request.QueryString["filetypeid"].ToString());
            }

            processlogVo = uploadsCommonBo.GetProcessLogInfo(ProcessId);
            if (uploadsCommonBo.ResetRejectedFlagByProcess(ProcessId, 9))
            {
                //Folio Chks in Std Folio Staging
                string packagePath = Server.MapPath("\\UploadPackages\\StandardFolioUploadPackageNew\\StandardFolioUploadPackageNew\\UploadsCommonFolioChecksInFolioStaging.dtsx");
                bool   camsFolioStagingChkResult = standardFolioUploadBo.StdFolioChksInFolioStaging(packagePath, adviserVo.advisorId, ProcessId, configPath);
                if (camsFolioStagingChkResult)
                {
                    //Folio Chks in Std Folio Staging
                    packagePath = Server.MapPath("\\UploadPackages\\StandardFolioUploadPackageNew\\StandardFolioUploadPackageNew\\UploadStdFolioFromFolioStagingToWerpTable.dtsx");
                    bool camsFolioWerpInsertionResult = standardFolioUploadBo.StdCustomerFolioCreation(packagePath, adviserVo.advisorId, ProcessId, configPath);
                    if (camsFolioWerpInsertionResult)
                    {
                        processlogVo.IsInsertionToWERPComplete = 1;
                        processlogVo.EndTime = DateTime.Now;
                        if (processlogVo.FileTypeId == 2)
                        {
                            processlogVo.IsInsertionToWERPComplete = 1;
                            processlogVo.EndTime               = DateTime.Now;
                            processlogVo.NoOfRejectedRecords   = uploadsCommonBo.GetProfileUploadRejectCount(ProcessId, "CA");
                            processlogVo.NoOfAccountsInserted  = uploadsCommonBo.GetAccountsUploadCount(ProcessId, "WPMF");
                            processlogVo.NoOfInputRejects      = uploadsCommonBo.GetUploadProfileInputRejectCount(ProcessId, "CA");
                            processlogVo.NoOfAccountDuplicates = processlogVo.NoOfTotalRecords - processlogVo.NoOfAccountsInserted - processlogVo.NoOfRejectedRecords;
                        }
                        else if (processlogVo.FileTypeId == 4)
                        {
                            processlogVo.IsInsertionToWERPComplete = 1;
                            processlogVo.EndTime               = DateTime.Now;
                            processlogVo.NoOfRejectedRecords   = uploadsCommonBo.GetProfileUploadRejectCount(ProcessId, "KA");
                            processlogVo.NoOfAccountsInserted  = uploadsCommonBo.GetAccountsUploadCount(ProcessId, "WPMF");
                            processlogVo.NoOfInputRejects      = uploadsCommonBo.GetUploadProfileInputRejectCount(ProcessId, "KA");
                            processlogVo.NoOfAccountDuplicates = processlogVo.NoOfTotalRecords - processlogVo.NoOfAccountsInserted - processlogVo.NoOfRejectedRecords;
                        }
                        else if (processlogVo.FileTypeId == 16)
                        {
                            processlogVo.IsInsertionToWERPComplete = 1;
                            processlogVo.EndTime               = DateTime.Now;
                            processlogVo.NoOfRejectedRecords   = uploadsCommonBo.GetProfileUploadRejectCount(ProcessId, "TN");
                            processlogVo.NoOfAccountsInserted  = uploadsCommonBo.GetAccountsUploadCount(ProcessId, "WPMF");
                            processlogVo.NoOfInputRejects      = uploadsCommonBo.GetUploadProfileInputRejectCount(ProcessId, "TN");
                            processlogVo.NoOfAccountDuplicates = processlogVo.NoOfTotalRecords - processlogVo.NoOfAccountsInserted - processlogVo.NoOfRejectedRecords;
                            blResult = uploadsCommonBo.UpdateUploadProcessLog(processlogVo);
                        }
                        else if (processlogVo.FileTypeId == 18)
                        {
                            processlogVo.IsInsertionToWERPComplete = 1;
                            processlogVo.EndTime               = DateTime.Now;
                            processlogVo.NoOfRejectedRecords   = uploadsCommonBo.GetProfileUploadRejectCount(ProcessId, "DT");
                            processlogVo.NoOfAccountsInserted  = uploadsCommonBo.GetAccountsUploadCount(ProcessId, "WPMF");
                            processlogVo.NoOfInputRejects      = uploadsCommonBo.GetUploadProfileInputRejectCount(ProcessId, "DT");
                            processlogVo.NoOfAccountDuplicates = processlogVo.NoOfTotalRecords - processlogVo.NoOfAccountsInserted - processlogVo.NoOfRejectedRecords;
                            blResult = uploadsCommonBo.UpdateUploadProcessLog(processlogVo);
                        }
                        blResult = uploadsCommonBo.UpdateUploadProcessLog(processlogVo);
                        if (blResult)
                        {
                            bool stdFolioCommonDeleteResult = standardFolioUploadBo.StdDeleteCommonStaging(ProcessId);
                        }
                    }
                }
            }

            if (blResult)
            {
                // Success Message
                trErrorMessage.Visible = true;
                lblError.Text          = "Reprocess Done Successfully!";
            }
            else
            {
                // Failure Message
                trErrorMessage.Visible = true;
                lblError.Text          = "Reprocess Failure!";
            }

            BindGrid(ProcessId);
        }
        protected void btnReprocess_Click(object sender, EventArgs e)
        {
            bool                    blResult                = false;
            UploadCommonBo          uploadsCommonBo         = new UploadCommonBo();
            UploadProcessLogVo      processlogVo            = new UploadProcessLogVo();
            UploadProcessLogVo      TempprocesslogVo        = new UploadProcessLogVo();
            StandardProfileUploadBo standardProfileUploadBo = new StandardProfileUploadBo();
            StandardFolioUploadBo   standardFolioUploadBo   = new StandardFolioUploadBo();
            CamsUploadsBo           camsUploadsBo           = new CamsUploadsBo();
            string                  strErrorDesc            = "Please a select a processId";
            DropDownList            ddl = (DropDownList)gvCAMSProfileReject.HeaderRow.Cells[0].FindControl("ddlProcessId");
            string                  val = ddl.SelectedValue;

            if (val == "Select")
            {
                Response.Write(@"<script language='javascript'>alert('The following errors have occurred: \n" + strErrorDesc + " .');</script>");
            }
            else
            {
                ProcessId = Convert.ToInt32(val);
                // BindGrid
                if (Request.QueryString["processId"] != null)
                {
                    ProcessId = Int32.Parse(Request.QueryString["processId"].ToString());
                }
                if (Request.QueryString["filetypeid"] != null)
                {
                    filetypeId = Int32.Parse(Request.QueryString["filetypeid"].ToString());
                }

                processlogVo = uploadsCommonBo.GetProcessLogInfo(ProcessId);
                if (uploadsCommonBo.ResetRejectedFlagByProcess(ProcessId, 9))
                {
                    //Folio Chks in Std Folio Staging
                    string packagePath = Server.MapPath("\\UploadPackages\\StandardFolioUploadPackageNew\\StandardFolioUploadPackageNew\\UploadsCommonFolioChecksInFolioStaging.dtsx");
                    bool   camsFolioStagingChkResult = standardFolioUploadBo.StdFolioChksInFolioStaging(packagePath, processlogVo.AdviserId, ProcessId, configPath);
                    if (camsFolioStagingChkResult)
                    {
                        //Folio Chks in Std Folio Staging
                        packagePath = Server.MapPath("\\UploadPackages\\StandardFolioUploadPackageNew\\StandardFolioUploadPackageNew\\UploadStdFolioFromFolioStagingToWerpTable.dtsx");
                        bool camsFolioWerpInsertionResult = standardFolioUploadBo.StdCustomerFolioCreation(packagePath, processlogVo.AdviserId, ProcessId, configPath);
                        if (camsFolioWerpInsertionResult)
                        {
                            processlogVo.IsInsertionToWERPComplete = 1;
                            processlogVo.EndTime = DateTime.Now;
                            if (processlogVo.FileTypeId == 2)
                            {
                                processlogVo.IsInsertionToWERPComplete = 1;
                                processlogVo.EndTime               = DateTime.Now;
                                processlogVo.NoOfRejectedRecords   = uploadsCommonBo.GetProfileUploadRejectCount(ProcessId, "CA");
                                processlogVo.NoOfAccountsInserted  = uploadsCommonBo.GetAccountsUploadCount(ProcessId, "WPMF");
                                processlogVo.NoOfInputRejects      = uploadsCommonBo.GetUploadProfileInputRejectCount(ProcessId, "CA");
                                processlogVo.NoOfAccountDuplicates = processlogVo.NoOfTotalRecords - processlogVo.NoOfAccountsInserted - processlogVo.NoOfRejectedRecords;
                            }
                            else if (processlogVo.FileTypeId == 4)
                            {
                                processlogVo.IsInsertionToWERPComplete = 1;
                                processlogVo.EndTime               = DateTime.Now;
                                processlogVo.NoOfRejectedRecords   = uploadsCommonBo.GetProfileUploadRejectCount(ProcessId, "KA");
                                processlogVo.NoOfAccountsInserted  = uploadsCommonBo.GetAccountsUploadCount(ProcessId, "WPMF");
                                processlogVo.NoOfInputRejects      = uploadsCommonBo.GetUploadProfileInputRejectCount(ProcessId, "KA");
                                processlogVo.NoOfAccountDuplicates = processlogVo.NoOfTotalRecords - processlogVo.NoOfAccountsInserted - processlogVo.NoOfRejectedRecords;
                            }
                            else if (processlogVo.FileTypeId == 16)
                            {
                                processlogVo.IsInsertionToWERPComplete = 1;
                                processlogVo.EndTime               = DateTime.Now;
                                processlogVo.NoOfRejectedRecords   = uploadsCommonBo.GetProfileUploadRejectCount(ProcessId, "TN");
                                processlogVo.NoOfAccountsInserted  = uploadsCommonBo.GetAccountsUploadCount(ProcessId, "WPMF");
                                processlogVo.NoOfInputRejects      = uploadsCommonBo.GetUploadProfileInputRejectCount(ProcessId, "TN");
                                processlogVo.NoOfAccountDuplicates = processlogVo.NoOfTotalRecords - processlogVo.NoOfAccountsInserted - processlogVo.NoOfRejectedRecords;
                                blResult = uploadsCommonBo.UpdateUploadProcessLog(processlogVo);
                            }
                            else if (processlogVo.FileTypeId == 18)
                            {
                                processlogVo.IsInsertionToWERPComplete = 1;
                                processlogVo.EndTime               = DateTime.Now;
                                processlogVo.NoOfRejectedRecords   = uploadsCommonBo.GetProfileUploadRejectCount(ProcessId, "DT");
                                processlogVo.NoOfAccountsInserted  = uploadsCommonBo.GetAccountsUploadCount(ProcessId, "WPMF");
                                processlogVo.NoOfInputRejects      = uploadsCommonBo.GetUploadProfileInputRejectCount(ProcessId, "DT");
                                processlogVo.NoOfAccountDuplicates = processlogVo.NoOfTotalRecords - processlogVo.NoOfAccountsInserted - processlogVo.NoOfRejectedRecords;
                                blResult = uploadsCommonBo.UpdateUploadProcessLog(processlogVo);
                            }
                            blResult = uploadsCommonBo.UpdateUploadProcessLog(processlogVo);
                            if (blResult)
                            {
                                bool stdFolioCommonDeleteResult = standardFolioUploadBo.StdDeleteCommonStaging(ProcessId);
                            }
                        }
                    }
                }

                if (blResult)
                {
                    // Success Message
                    trErrorMessage.Visible = true;
                    lblError.Text          = "Reprocess Done Successfully!";
                }
                else
                {
                    // Failure Message
                    trErrorMessage.Visible = true;
                    lblError.Text          = "Reprocess Failure!";
                }

                BindGrid(ProcessId);
            }
        }
        protected void btnProbableInsert_Click(object sender, EventArgs e)
        {
            bool   result       = true;
            bool   blResult     = true;
            string gvStagingIds = "";

            uploadsCommonBo = new UploadCommonBo();
            processlogVo    = uploadsCommonBo.GetProcessLogInfo(ProcessId);

            int fileTypeId = processlogVo.FileTypeId;

            rejectedRecordsBo = new RejectedRecordsBo();
            foreach (GridDataItem gvRow in gvWERPTrans.MasterTableView.Items)
            //foreach (GridViewRow gvRow in gvWERPTrans.Rows)
            {
                CheckBox ChkBxItem = (CheckBox)gvRow.FindControl("chkId");
                if (ChkBxItem.Checked)
                {
                    gvStagingIds += gvWERPTrans.MasterTableView.DataKeyValues[gvRow.RowIndex]["CMFTSId"].ToString() + ",";
                }
            }
            result = rejectedRecordsBo.InsertProbableDuplicatesRejectedTransaction(gvStagingIds);
            if (result)
            {
                // Success Message
                processlogVo.IsInsertionToWERPComplete = 1;
                processlogVo.NoOfTransactionInserted   = uploadsCommonBo.GetTransUploadCount(ProcessId, "WPMF");

                processlogVo.EndTime = DateTime.Now;

                if (fileTypeId == 1)
                {
                    processlogVo.NoOfRejectedRecords = uploadsCommonBo.GetTransUploadRejectCount(ProcessId, Contants.UploadExternalTypeCAMS);
                }
                else if (fileTypeId == 3)
                {
                    processlogVo.NoOfRejectedRecords = uploadsCommonBo.GetTransUploadRejectCount(ProcessId, Contants.UploadExternalTypeKarvy);
                }
                else if (fileTypeId == 15)
                {
                    processlogVo.NoOfRejectedRecords = uploadsCommonBo.GetTransUploadRejectCount(ProcessId, Contants.UploadExternalTypeTemp);
                }
                else if (fileTypeId == 17)
                {
                    processlogVo.NoOfRejectedRecords = uploadsCommonBo.GetTransUploadRejectCount(ProcessId, Contants.UploadExternalTypeDeutsche);
                }
                else if (filetypeId == 25)
                {
                    processlogVo.NoOfRejectedRecords = uploadsCommonBo.GetTransUploadRejectCount(ProcessId, "SU");
                }
                blResult = uploadsCommonBo.UpdateUploadProcessLog(processlogVo);

                ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "pageloadscript", "alert('Records Inserted Successfully');", true);
            }
            else
            {
                // Failure Message
                ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "pageloadscript", "alert('Please Select Probable Duplicate Records');", true);
            }

            BindEquityTransactionGrid(ProcessId);
        }