private bool MapfoliotoCustomer(int customerId)
        {
            int i;

            string[] testArrayFolio      = new string[0];
            string[] testArray           = new string[0];
            string[] testArraySIPFolio   = new string[0];
            string[] testArrayTrailFolio = new string[0];
            bool     result = true;
            UserVo   userVo = (UserVo)Session["userVo"];
            RejectedTransactionsBo rejectedTransactionsBo = new RejectedTransactionsBo();
            string folioId = Convert.ToString(Request.Params["Folioid"]);

            if (folioId != null)
            {
                testArrayFolio = folioId.Split('~');
            }
            string transactionId = Convert.ToString(Request.Params["id"]);

            if (transactionId != null)
            {
                testArray = transactionId.Split('~');
            }


            string SIPFolioid = Convert.ToString(Request.Params["SIPFolioid"]);

            if (SIPFolioid != null)
            {
                testArraySIPFolio = SIPFolioid.Split('~');
            }
            string TrailFolioid = Convert.ToString(Request.Params["TrailFolioid"]);

            if (TrailFolioid != null)
            {
                testArrayTrailFolio = TrailFolioid.Split('~');
            }

            int userId = userVo.UserId;

            if (transactionId != null)
            {
                for (i = 0; i < testArray.Length; i++)
                {
                    MFTransactionStagingId = int.Parse(testArray[i]);
                    result = rejectedTransactionsBo.MapFolioToCustomer(MFTransactionStagingId, customerId, userId);
                }
            }
            if (folioId != null)
            {
                for (i = 0; i < testArrayFolio.Length; i++)
                {
                    MFFolioStagingId = int.Parse(testArrayFolio[i]);
                    result           = rejectedTransactionsBo.MapRejectedFoliosToCustomer(MFFolioStagingId, customerId, userId);
                }
            }
            if (TrailFolioid != null)
            {
                for (i = 0; i < testArrayTrailFolio.Length; i++)
                {
                    MFTrailFolioStagingid = int.Parse(testArrayTrailFolio[i]);
                    result = rejectedTransactionsBo.MapRejectedTrailFoliosToCustomer(MFTrailFolioStagingid, customerId, userId);
                }
            }
            if (SIPFolioid != null)
            {
                for (i = 0; i < testArray.Length; i++)
                {
                    MFSIPFolioStagingId = int.Parse(testArraySIPFolio[i]);
                    result = rejectedTransactionsBo.MapRejectedSIPFoliosToCustomer(MFSIPFolioStagingId, customerId, userId);
                }
            }

            //MFTransactionStagingId = Convert.ToInt32(Request.Params["id"]);
            //result = rejectedTransactionsBo.MapFolioToCustomer(MFTransactionStagingId, customerId, userId);
            //for (int i = 0; i < Stagingtableid.Count; i++)
            //{
            //    try
            //    {
            //        MFTransactionStagingId = Convert.ToInt32(Stagingtableid[i]);
            //        result = rejectedTransactionsBo.MapFolioToCustomer(MFTransactionStagingId, customerId, userId);
            //    }
            //    catch (Exception ex)
            //    {
            //        result = false;
            //    }
            //}
            return(result);
        }
        protected void gvCustomers_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int i;
            int userId     = 0;
            int customerId = 0;

            string[] testArrayFolio      = new string[0];
            string[] testArray           = new string[0];
            string[] testArraySIPFolio   = new string[0];
            string[] testArrayTrailFolio = new string[0];

            customerId = Convert.ToInt32(e.CommandArgument);
            UserVo userVo = (UserVo)Session["userVo"];

            userId = userVo.UserId;
            bool insertioncomplete = true;
            CustomerAccountsVo customerAccountsVo = new CustomerAccountsVo();
            CustomerAccountBo  customerBo         = new CustomerAccountBo();
            GridView           gv = (GridView)sender;
            //string transactionId = Convert.ToString(Request.Params["id"]);
            //string folioId = Convert.ToString(Request.Params["Folioid"]);
            //string[] testArrayFolio = folioId.Split('~');
            //string[] testArray = transactionId.Split('~');
            string folioId = Convert.ToString(Request.Params["Folioid"]);

            if (folioId != null)
            {
                testArrayFolio = folioId.Split('~');
            }
            string transactionId = Convert.ToString(Request.Params["id"]);

            if (transactionId != null)
            {
                testArray = transactionId.Split('~');
            }
            string SIPFolioid = Convert.ToString(Request.Params["SIPFolioid"]);

            if (SIPFolioid != null)
            {
                testArraySIPFolio = SIPFolioid.Split('~');
            }
            string TrailFolioid = Convert.ToString(Request.Params["TrailFolioid"]);

            if (TrailFolioid != null)
            {
                testArrayTrailFolio = TrailFolioid.Split('~');
            }

            RejectedTransactionsBo rejectedTransactionsBo = new RejectedTransactionsBo();

            try
            {
                if (transactionId != null)
                {
                    for (i = 0; i < testArray.Length; i++)
                    {
                        MFTransactionStagingId = int.Parse(testArray[i]);
                        insertioncomplete      = rejectedTransactionsBo.MapFolioToCustomer(MFTransactionStagingId, customerId, userId);
                    }
                }
                if (SIPFolioid != null)
                {
                    for (i = 0; i < testArraySIPFolio.Length; i++)
                    {
                        MFSIPFolioStagingId = int.Parse(testArraySIPFolio[i]);
                        insertioncomplete   = rejectedTransactionsBo.MapRejectedSIPFoliosToCustomer(MFSIPFolioStagingId, customerId, userId);
                    }
                }
                if (folioId != null)
                {
                    for (i = 0; i < testArrayFolio.Length; i++)
                    {
                        MFFolioStagingId  = int.Parse(testArrayFolio[i]);
                        insertioncomplete = rejectedTransactionsBo.MapRejectedFoliosToCustomer(MFFolioStagingId, customerId, userId);
                    }
                }
                if (TrailFolioid != null)
                {
                    for (i = 0; i < testArrayTrailFolio.Length; i++)
                    {
                        MFTrailFolioStagingid = int.Parse(testArrayTrailFolio[i]);
                        insertioncomplete     = rejectedTransactionsBo.MapRejectedTrailFoliosToCustomer(MFTrailFolioStagingid, customerId, userId);
                    }
                }
            }
            catch (Exception ex)
            {
                insertioncomplete = false;
            }

            if (insertioncomplete)
            {
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "mykey", "ClosePopUp();", true);
                divMapToCustomer.Visible = false;
                lblMessage.Visible       = true;
                lblMessage.Text          = "Customer is mapped";
                lblMessage.CssClass      = "SuccessMsg";
                tblSearch.Visible        = false;
                //reprocess();
            }
            else
            {
                lblMessage.Visible = true;
                lblMessage.Text    = "An error occurred while mapping.";
            }
        }