public void DisplaySOData()
        {
            BrilliantWMS.WMSInbound.iInboundClient   Inbound  = new WMSInbound.iInboundClient();
            BrilliantWMS.WMSOutbound.iOutboundClient Outbound = new WMSOutbound.iOutboundClient();
            List <BrilliantWMS.WMSOutbound.WMS_SP_GetPartDetail_ForDispatch_Result> QCDetail = new List <WMSOutbound.WMS_SP_GetPartDetail_ForDispatch_Result>();

            try
            {
                CustomProfile profile = CustomProfile.GetProfile();
                if (Session["QCID"] != null)
                {
                    long QCID       = long.Parse(Session["QCID"].ToString());
                    int  chkJObCart = Inbound.CheckJobCard(Convert.ToInt64(HttpContext.Current.Session["QCID"].ToString()), "Dispatch", profile.DBConnection._constr);
                    if (chkJObCart >= 1)
                    {
                        DataSet dsJCN = new DataSet();
                        dsJCN = Outbound.CheckSelectedSOJobCardNo(Convert.ToInt64(HttpContext.Current.Session["QCID"].ToString()), "Dispatch", profile.DBConnection._constr);
                        if (dsJCN != null && dsJCN.Tables[0].Rows.Count > 0)
                        {
                            string grpQCID = dsJCN.Tables[0].Rows[0]["OrderNo"].ToString();
                            QCDetail = Outbound.GetDispatchPartByQCID(grpQCID, "0", Session.SessionID, profile.Personal.UserID.ToString(), ObjectName, profile.DBConnection._constr).ToList();
                        }
                    }
                    else
                    {
                        QCDetail = Outbound.GetDispatchPartByQCID(QCID.ToString(), "0", Session.SessionID, profile.Personal.UserID.ToString(), ObjectName, profile.DBConnection._constr).ToList();
                    }
                }
                else if (Session["TRID"] != null)
                {
                    long TRID       = long.Parse(Session["TRID"].ToString());
                    int  chkJObCart = Inbound.CheckJobCard(Convert.ToInt64(HttpContext.Current.Session["TRID"].ToString()), "Transfer", profile.DBConnection._constr);
                    if (chkJObCart >= 1)
                    {
                        DataSet dsJCN = new DataSet();
                        dsJCN = Outbound.CheckSelectedSOJobCardNo(Convert.ToInt64(HttpContext.Current.Session["TRID"].ToString()), "Transfer", profile.DBConnection._constr);
                        if (dsJCN != null && dsJCN.Tables[0].Rows.Count > 0)
                        {
                            string grpQCID = dsJCN.Tables[0].Rows[0]["OrderNo"].ToString();
                            QCDetail = Outbound.GetDispatchPartByQCID("0", grpQCID, Session.SessionID, profile.Personal.UserID.ToString(), ObjectName, profile.DBConnection._constr).ToList();
                        }
                    }
                    else
                    {
                        QCDetail = Outbound.GetDispatchPartByQCID("0", TRID.ToString(), Session.SessionID, profile.Personal.UserID.ToString(), ObjectName, profile.DBConnection._constr).ToList();
                    }
                }
                Grid1.DataSource = null;
                Grid1.DataBind();
                Grid1.DataSource = QCDetail;
                Grid1.DataBind();
            }
            catch (System.Exception ex)
            {
                Login.Profile.ErrorHandling(ex, "DispatchDetail.aspx", "DisplayPOData");
            }
            finally { Outbound.Close(); Inbound.Close(); }
        }
        public static long WMSaveDispatchHead(object objDispatch)
        {
            long result = 0;
            int  RSLT = 0; long DispatchID = 0;

            BrilliantWMS.WMSInbound.iInboundClient   Inbound = new WMSInbound.iInboundClient();
            BrilliantWMS.WMSOutbound.iOutboundClient Outbound = new WMSOutbound.iOutboundClient();
            try
            {
                CustomProfile profile = CustomProfile.GetProfile();
                BrilliantWMS.WMSOutbound.tDispatchHead dh = new WMSOutbound.tDispatchHead();
                Dictionary <string, object>            d  = new Dictionary <string, object>();
                d = (Dictionary <string, object>)objDispatch;
                if (HttpContext.Current.Session["QCID"] != null)
                {
                    int chkJObCart = Inbound.CheckJobCard(Convert.ToInt64(HttpContext.Current.Session["QCID"].ToString()), "Dispatch", profile.DBConnection._constr);
                    if (chkJObCart >= 1)
                    {
                        DataSet dsJCN = new DataSet();
                        dsJCN = Outbound.CheckSelectedSOJobCardNo(Convert.ToInt64(HttpContext.Current.Session["QCID"].ToString()), "Dispatch", profile.DBConnection._constr);
                        if (dsJCN != null && dsJCN.Tables[0].Rows.Count > 0)
                        {
                            string   grpQCID = dsJCN.Tables[0].Rows[0]["OrderNo"].ToString();
                            string[] TotQC   = grpQCID.Split(',');
                            int      QCCnt   = TotQC.Count();
                            for (int p = 0; p <= QCCnt - 1; p++)
                            {
                                dh.CreatedBy         = profile.Personal.UserID;
                                dh.CreationDate      = DateTime.Now;
                                dh.OID               = long.Parse(TotQC[p].ToString());
                                dh.DispatchDate      = Convert.ToDateTime(d["DispatchDate"]);
                                dh.DispatchBy        = Convert.ToInt64(d["DispatchBy"].ToString());
                                dh.Remark            = d["Remark"].ToString();
                                dh.AirwayBill        = d["AirwayBill"].ToString();
                                dh.ShippingType      = d["ShippingType"].ToString();
                                dh.CompanyID         = profile.Personal.CompanyID;
                                dh.Status            = Convert.ToInt64(d["Status"].ToString());
                                dh.ShippingDate      = Convert.ToDateTime(d["ShippingDate"].ToString());
                                dh.TransporterName   = d["TransporterName"].ToString();
                                dh.TransporterRemark = d["TransporterRemark"].ToString();
                                dh.ExpDeliveryDate   = Convert.ToDateTime(d["ExpDeliveryDate"].ToString());
                                dh.ObjectName        = "SalesOrder";

                                DispatchID = Outbound.SavetDispatchHead(dh, profile.DBConnection._constr);

                                if (DispatchID > 0)
                                {
                                    RSLT = Outbound.FinalSaveDispatchDetail(long.Parse(TotQC[p].ToString()), HttpContext.Current.Session.SessionID, ObjectName, DispatchID, profile.Personal.UserID.ToString(), Convert.ToInt16(dh.Status), "SalesOrder", profile.DBConnection._constr);
                                    if (RSLT == 1 || RSLT == 2)
                                    {
                                        result = DispatchID;
                                    }
                                    else if (RSLT == 0)
                                    {
                                        result = 0;
                                    }
                                    iUC_AttachDocumentClient DocumentSourceClient = new iUC_AttachDocumentClient();//Document Save
                                    DocumentSourceClient.FinalSaveToDBtDocument(HttpContext.Current.Session.SessionID, DispatchID, profile.Personal.UserID.ToString(), ObjectName + "Document", HttpRuntime.AppDomainAppPath.ToString(), profile.DBConnection._constr);
                                }
                            }
                            Outbound.ClearTempDataFromDBDispatch(HttpContext.Current.Session.SessionID, profile.Personal.UserID.ToString(), ObjectName, profile.DBConnection._constr);
                        }
                    }
                    else
                    {
                        dh.CreatedBy         = profile.Personal.UserID;
                        dh.CreationDate      = DateTime.Now;
                        dh.OID               = long.Parse(HttpContext.Current.Session["QCID"].ToString());
                        dh.DispatchDate      = Convert.ToDateTime(d["DispatchDate"]);
                        dh.DispatchBy        = Convert.ToInt64(d["DispatchBy"].ToString());
                        dh.Remark            = d["Remark"].ToString();
                        dh.AirwayBill        = d["AirwayBill"].ToString();
                        dh.ShippingType      = d["ShippingType"].ToString();
                        dh.CompanyID         = profile.Personal.CompanyID;
                        dh.Status            = Convert.ToInt64(d["Status"].ToString());
                        dh.ShippingDate      = Convert.ToDateTime(d["ShippingDate"].ToString());
                        dh.TransporterName   = d["TransporterName"].ToString();
                        dh.TransporterRemark = d["TransporterRemark"].ToString();
                        dh.ExpDeliveryDate   = Convert.ToDateTime(d["ExpDeliveryDate"].ToString());
                        dh.ObjectName        = "SalesOrder";

                        DispatchID = Outbound.SavetDispatchHead(dh, profile.DBConnection._constr);

                        if (DispatchID > 0)
                        {
                            RSLT = Outbound.FinalSaveDispatchDetail(long.Parse(HttpContext.Current.Session["QCID"].ToString()), HttpContext.Current.Session.SessionID, ObjectName, DispatchID, profile.Personal.UserID.ToString(), Convert.ToInt16(dh.Status), "SalesOrder", profile.DBConnection._constr);
                            if (RSLT == 1 || RSLT == 2)
                            {
                                result = DispatchID;
                            }
                            else if (RSLT == 0)
                            {
                                result = 0;
                            }
                            iUC_AttachDocumentClient DocumentSourceClient = new iUC_AttachDocumentClient();//Document Save
                            DocumentSourceClient.FinalSaveToDBtDocument(HttpContext.Current.Session.SessionID, DispatchID, profile.Personal.UserID.ToString(), ObjectName + "Document", HttpRuntime.AppDomainAppPath.ToString(), profile.DBConnection._constr);
                        }
                        Outbound.ClearTempDataFromDBDispatch(HttpContext.Current.Session.SessionID, profile.Personal.UserID.ToString(), ObjectName, profile.DBConnection._constr);
                    }
                }
                else if (HttpContext.Current.Session["TRID"] != null)
                {
                    int chkJObCart = Inbound.CheckJobCard(Convert.ToInt64(HttpContext.Current.Session["TRID"].ToString()), "Transfer", profile.DBConnection._constr);
                    if (chkJObCart >= 1)
                    {
                        DataSet dsJCN = new DataSet();
                        dsJCN = Outbound.CheckSelectedSOJobCardNo(Convert.ToInt64(HttpContext.Current.Session["TRID"].ToString()), "Transfer", profile.DBConnection._constr);
                        if (dsJCN != null && dsJCN.Tables[0].Rows.Count > 0)
                        {
                            string   grpQCID = dsJCN.Tables[0].Rows[0]["OrderNo"].ToString();
                            string[] TotQC   = grpQCID.Split(',');
                            int      QCCnt   = TotQC.Count();
                            for (int p = 0; p <= QCCnt - 1; p++)
                            {
                                dh.CreatedBy         = profile.Personal.UserID;
                                dh.CreationDate      = DateTime.Now;
                                dh.OID               = long.Parse(TotQC[p].ToString());
                                dh.DispatchDate      = Convert.ToDateTime(d["DispatchDate"]);
                                dh.DispatchBy        = Convert.ToInt64(d["DispatchBy"].ToString());
                                dh.Remark            = d["Remark"].ToString();
                                dh.AirwayBill        = d["AirwayBill"].ToString();
                                dh.ShippingType      = d["ShippingType"].ToString();
                                dh.CompanyID         = profile.Personal.CompanyID;
                                dh.Status            = Convert.ToInt64(d["Status"].ToString());
                                dh.ShippingDate      = Convert.ToDateTime(d["ShippingDate"].ToString());
                                dh.TransporterName   = d["TransporterName"].ToString();
                                dh.TransporterRemark = d["TransporterRemark"].ToString();
                                dh.ExpDeliveryDate   = Convert.ToDateTime(d["ExpDeliveryDate"].ToString());
                                dh.ObjectName        = "Transfer";

                                DispatchID = Outbound.SavetDispatchHead(dh, profile.DBConnection._constr);

                                if (DispatchID > 0)
                                {
                                    RSLT = Outbound.FinalSaveDispatchDetail(long.Parse(TotQC[p].ToString()), HttpContext.Current.Session.SessionID, ObjectName, DispatchID, profile.Personal.UserID.ToString(), Convert.ToInt16(dh.Status), "Transfer", profile.DBConnection._constr);
                                    if (RSLT == 1 || RSLT == 2)
                                    {
                                        result = DispatchID;
                                    }
                                    else if (RSLT == 0)
                                    {
                                        result = 0;
                                    }
                                    iUC_AttachDocumentClient DocumentSourceClient = new iUC_AttachDocumentClient();//Document Save
                                    DocumentSourceClient.FinalSaveToDBtDocument(HttpContext.Current.Session.SessionID, DispatchID, profile.Personal.UserID.ToString(), ObjectName + "Document", HttpRuntime.AppDomainAppPath.ToString(), profile.DBConnection._constr);
                                }
                            }
                            Outbound.ClearTempDataFromDBDispatch(HttpContext.Current.Session.SessionID, profile.Personal.UserID.ToString(), ObjectName, profile.DBConnection._constr);
                        }
                    }
                    else
                    {
                        dh.CreatedBy         = profile.Personal.UserID;
                        dh.CreationDate      = DateTime.Now;
                        dh.OID               = long.Parse(HttpContext.Current.Session["TRID"].ToString());
                        dh.DispatchDate      = Convert.ToDateTime(d["DispatchDate"]);
                        dh.DispatchBy        = Convert.ToInt64(d["DispatchBy"].ToString());
                        dh.Remark            = d["Remark"].ToString();
                        dh.AirwayBill        = d["AirwayBill"].ToString();
                        dh.ShippingType      = d["ShippingType"].ToString();
                        dh.CompanyID         = profile.Personal.CompanyID;
                        dh.Status            = Convert.ToInt64(d["Status"].ToString());
                        dh.ShippingDate      = Convert.ToDateTime(d["ShippingDate"].ToString());
                        dh.TransporterName   = d["TransporterName"].ToString();
                        dh.TransporterRemark = d["TransporterRemark"].ToString();
                        dh.ExpDeliveryDate   = Convert.ToDateTime(d["ExpDeliveryDate"].ToString());
                        dh.ObjectName        = "Transfer";

                        DispatchID = Outbound.SavetDispatchHead(dh, profile.DBConnection._constr);

                        if (DispatchID > 0)
                        {
                            RSLT = Outbound.FinalSaveDispatchDetail(long.Parse(HttpContext.Current.Session["TRID"].ToString()), HttpContext.Current.Session.SessionID, ObjectName, DispatchID, profile.Personal.UserID.ToString(), Convert.ToInt16(dh.Status), "Transfer", profile.DBConnection._constr);
                            if (RSLT == 1 || RSLT == 2)
                            {
                                result = DispatchID;
                            }
                            else if (RSLT == 0)
                            {
                                result = 0;
                            }
                            iUC_AttachDocumentClient DocumentSourceClient = new iUC_AttachDocumentClient();//Document Save
                            DocumentSourceClient.FinalSaveToDBtDocument(HttpContext.Current.Session.SessionID, DispatchID, profile.Personal.UserID.ToString(), ObjectName + "Document", HttpRuntime.AppDomainAppPath.ToString(), profile.DBConnection._constr);
                        }
                        Outbound.ClearTempDataFromDBDispatch(HttpContext.Current.Session.SessionID, profile.Personal.UserID.ToString(), ObjectName, profile.DBConnection._constr);
                    }
                }
            }
            catch (System.Exception ex) { Login.Profile.ErrorHandling(ex, "DispatchDetail.aspx", "WMSaveDispatchHead"); result = 0; }
            finally { Outbound.Close(); }
            return(result);
        }
        public void fillUser()
        {
            BrilliantWMS.WMSInbound.iInboundClient   Inbound  = new WMSInbound.iInboundClient();
            BrilliantWMS.WMSOutbound.iOutboundClient Outbound = new WMSOutbound.iOutboundClient();
            iUCCommonFilterClient          objService         = new iUCCommonFilterClient();
            List <vGetUserProfileByUserID> UsersList          = new List <vGetUserProfileByUserID>();

            try
            {
                CustomProfile profile = CustomProfile.GetProfile();
                BrilliantWMS.WMSOutbound.tOrderHead OH = new WMSOutbound.tOrderHead();
                long WarehouseID = 0;
                if (Session["QCID"] != null)
                {
                    int chkJObCart = Inbound.CheckJobCard(Convert.ToInt64(HttpContext.Current.Session["QCID"].ToString()), "SalesOrder", profile.DBConnection._constr);
                    if (chkJObCart >= 1)
                    {
                        DataSet dsJCN = new DataSet();
                        dsJCN = Outbound.CheckSelectedSOJobCardNo(Convert.ToInt64(HttpContext.Current.Session["QCID"].ToString()), "SalesOrder", profile.DBConnection._constr);
                        if (dsJCN != null && dsJCN.Tables[0].Rows.Count > 0)
                        {
                            //lblSelectedPO.Text = dsJCN.Tables[0].Rows[0]["OrderNo"].ToString();
                            //lblSelectedGTN.Text = dsJCN.Tables[0].Rows[0]["JobCardName"].ToString();
                            //lblPurchaseOrderDate.Text = dsJCN.Tables[0].Rows[0]["CreationDate"].ToString();
                            //lblPOBy.Text = dsJCN.Tables[0].Rows[0]["CreatedByUser"].ToString();
                            WarehouseID = long.Parse(dsJCN.Tables[0].Rows[0]["Warehouse"].ToString());
                        }
                    }
                    else
                    {
                        OH = Outbound.GetSoDetailByQCID(Convert.ToInt64(HttpContext.Current.Session["QCID"].ToString()), profile.DBConnection._constr);
                        //lblSelectedPO.Text = Session["POID"].ToString();
                        //lblSelectedGTN.Text = "Not Created";
                        //lblPurchaseOrderDate.Text = POHead.POdate.Value.ToString("dd-MMM-yyyy");
                        //lblPOBy.Text = Inbound.GetUserNameByID(long.Parse(POHead.CreatedBy.ToString()), profile.DBConnection._constr);
                        WarehouseID = long.Parse(OH.StoreId.ToString());
                    }
                }
                else if (Session["TRID"] != null)
                {
                    int chkJObCart = Inbound.CheckJobCard(Convert.ToInt64(HttpContext.Current.Session["TRID"].ToString()), "Transfer", profile.DBConnection._constr);
                    if (chkJObCart >= 1)
                    {
                        DataSet dsJCN = new DataSet();
                        dsJCN = Outbound.CheckSelectedSOJobCardNo(Convert.ToInt64(HttpContext.Current.Session["TRID"].ToString()), "Transfer", profile.DBConnection._constr);
                        if (dsJCN != null && dsJCN.Tables[0].Rows.Count > 0)
                        {
                            WarehouseID = long.Parse(dsJCN.Tables[0].Rows[0]["Warehouse"].ToString());
                        }
                    }
                    else
                    {
                        BrilliantWMS.WMSInbound.tTransferHead TRHead = new WMSInbound.tTransferHead();
                        TRHead      = Inbound.GetTransferHeadByTRID(Convert.ToInt64(HttpContext.Current.Session["TRID"].ToString()), profile.DBConnection._constr);
                        WarehouseID = long.Parse(TRHead.FromPosition.ToString());
                    }
                }
                UsersList = objService.GetUserListByWarehouseID(WarehouseID, profile.DBConnection._constr).ToList();
                UsersList = UsersList.Where(x => x.userID == profile.Personal.UserID).ToList();
                vGetUserProfileByUserID select = new vGetUserProfileByUserID()
                {
                    userID = 0, userName = "******"
                };
                UsersList.Insert(0, select);

                ddlDispatchBy.DataSource = UsersList;
                ddlDispatchBy.DataBind();
            }
            catch { }
            finally { objService.Close(); }
        }
        protected void BtnSequence_Click(object sender, EventArgs e)
        {
            int    RSLT = 0; long PkUpID = 0;
            string confirmValue = Request.Form["confirm_value"];

            BrilliantWMS.WMSOutbound.iOutboundClient Outbound = new WMSOutbound.iOutboundClient();
            BrilliantWMS.WMSInbound.iInboundClient   Inbound  = new WMSInbound.iInboundClient();
            try
            {
                if (confirmValue == "Yes")
                {
                    CustomProfile profile = CustomProfile.GetProfile();
                    BrilliantWMS.WMSOutbound.tPickUpHead pkh = new WMSOutbound.tPickUpHead();
                    //BrilliantWMS.WMSOutbound.tTransferHead trh = new WMSOutbound.tTransferHead();
                    if (Session["SOID"] != null)
                    {
                        int chkJObCart = Inbound.CheckJobCard(Convert.ToInt64(HttpContext.Current.Session["SOID"].ToString()), "SalesOrder", profile.DBConnection._constr);
                        if (chkJObCart >= 1)
                        {
                            DataSet dsJCN = new DataSet();
                            dsJCN = Outbound.CheckSelectedSOJobCardNo(Convert.ToInt64(HttpContext.Current.Session["SOID"].ToString()), "SalesOrder", profile.DBConnection._constr);
                            if (dsJCN != null && dsJCN.Tables[0].Rows.Count > 0)
                            {
                                string   grpSOID = dsJCN.Tables[0].Rows[0]["OrderNo"].ToString();
                                string[] TotOD   = grpSOID.Split(',');
                                int      ODCnt   = TotOD.Count();
                                for (int q = 0; q <= ODCnt - 1; q++)
                                {
                                    pkh.CreatedBy    = profile.Personal.UserID;
                                    pkh.CreationDate = DateTime.Now;
                                    pkh.ObjectName   = "SalesOrder";
                                    pkh.OID          = long.Parse(TotOD[q].ToString());
                                    pkh.PickUpDate   = DateTime.Now;
                                    pkh.Status       = 38;
                                    pkh.CompanyID    = profile.Personal.CompanyID;
                                    pkh.PickUpBy     = profile.Personal.UserID;

                                    PkUpID = Outbound.SavetPickUpHead(pkh, profile.DBConnection._constr);

                                    if (PkUpID > 0)
                                    {
                                        RSLT = Outbound.FinalSavePickUpDetail(long.Parse(TotOD[q].ToString()), Session.SessionID, ObjectName, PkUpID, profile.Personal.UserID.ToString(), Convert.ToInt16(pkh.Status), profile.DBConnection._constr);
                                        if (RSLT == 1)
                                        {
                                            this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "showAlert('Products Picked Up Successfully!','info','../WMS/PickUpList.aspx')", true);
                                        }
                                        else
                                        {
                                            this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "showAlert('Some Error Occured!','info','../WMS/PickUpList.aspx')", true);
                                        }
                                    }
                                }
                                Outbound.ClearTempDataFromDBPickUp(HttpContext.Current.Session.SessionID, profile.Personal.UserID.ToString(), ObjectName, profile.DBConnection._constr);
                            }
                        }
                        else
                        {
                            pkh.CreatedBy    = profile.Personal.UserID;
                            pkh.CreationDate = DateTime.Now;
                            pkh.ObjectName   = "SalesOrder";
                            pkh.OID          = long.Parse(Session["SOID"].ToString());
                            pkh.PickUpDate   = DateTime.Now;
                            pkh.Status       = 38;
                            pkh.CompanyID    = profile.Personal.CompanyID;
                            pkh.PickUpBy     = profile.Personal.UserID;

                            PkUpID = Outbound.SavetPickUpHead(pkh, profile.DBConnection._constr);
                            if (PkUpID > 0)
                            {
                                RSLT = Outbound.FinalSavePickUpDetail(long.Parse(Session["SOID"].ToString()), Session.SessionID, ObjectName, PkUpID, profile.Personal.UserID.ToString(), Convert.ToInt16(pkh.Status), profile.DBConnection._constr);
                                if (RSLT == 1)
                                {
                                    this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "showAlert('Products Picked Up Successfully!','info','../WMS/PickUpList.aspx')", true);
                                }
                                else
                                {
                                    this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "showAlert('Some Error Occured!','info','../WMS/PickUpList.aspx')", true);
                                }
                            }
                            Outbound.ClearTempDataFromDBPickUp(HttpContext.Current.Session.SessionID, profile.Personal.UserID.ToString(), ObjectName, profile.DBConnection._constr);
                        }
                    }
                    else if (Session["TRID"] != null)
                    {
                        int chkJObCart = Inbound.CheckJobCard(Convert.ToInt64(HttpContext.Current.Session["TRID"].ToString()), "Transfer", profile.DBConnection._constr);
                        if (chkJObCart >= 1)
                        {
                            DataSet dsJCN = new DataSet();
                            dsJCN = Outbound.CheckSelectedSOJobCardNo(Convert.ToInt64(HttpContext.Current.Session["TRID"].ToString()), "Transfer", profile.DBConnection._constr);
                            if (dsJCN != null && dsJCN.Tables[0].Rows.Count > 0)
                            {
                                string   grpSOID = dsJCN.Tables[0].Rows[0]["OrderNo"].ToString();
                                string[] TotOD   = grpSOID.Split(',');
                                int      ODCnt   = TotOD.Count();
                                for (int q = 0; q <= ODCnt - 1; q++)
                                {
                                    pkh.CreatedBy    = profile.Personal.UserID;
                                    pkh.CreationDate = DateTime.Now;
                                    pkh.ObjectName   = "Transfer";
                                    pkh.OID          = long.Parse(TotOD[q].ToString());
                                    pkh.PickUpDate   = DateTime.Now;
                                    pkh.Status       = 57;
                                    pkh.CompanyID    = profile.Personal.CompanyID;
                                    pkh.PickUpBy     = profile.Personal.UserID;

                                    PkUpID = Outbound.SavetPickUpHead(pkh, profile.DBConnection._constr);

                                    if (PkUpID > 0)
                                    {
                                        RSLT = Outbound.FinalSavePickUpDetail(long.Parse(TotOD[q].ToString()), Session.SessionID, ObjectName, PkUpID, profile.Personal.UserID.ToString(), Convert.ToInt16(pkh.Status), profile.DBConnection._constr);
                                        if (RSLT == 1)
                                        {
                                            this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "showAlert('Products Picked Up Successfully!','info','../WMS/Transfer.aspx')", true);
                                        }
                                        else
                                        {
                                            this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "showAlert('Some Error Occured!','info','../WMS/Transfer.aspx')", true);
                                        }
                                    }
                                }
                                Outbound.ClearTempDataFromDBPickUp(HttpContext.Current.Session.SessionID, profile.Personal.UserID.ToString(), ObjectName, profile.DBConnection._constr);
                            }
                        }
                        else
                        {
                            pkh.CreatedBy    = profile.Personal.UserID;
                            pkh.CreationDate = DateTime.Now;
                            pkh.ObjectName   = "Transfer";
                            pkh.OID          = long.Parse(Session["TRID"].ToString());
                            pkh.PickUpDate   = DateTime.Now;
                            pkh.Status       = 57;
                            pkh.CompanyID    = profile.Personal.CompanyID;
                            pkh.PickUpBy     = profile.Personal.UserID;

                            PkUpID = Outbound.SavetPickUpHead(pkh, profile.DBConnection._constr);
                            if (PkUpID > 0)
                            {
                                RSLT = Outbound.FinalSavePickUpDetail(long.Parse(Session["TRID"].ToString()), Session.SessionID, ObjectName, PkUpID, profile.Personal.UserID.ToString(), Convert.ToInt16(pkh.Status), profile.DBConnection._constr);
                                if (RSLT == 1)
                                {
                                    this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "showAlert('Products Picked Up Successfully!','info','../WMS/Transfer.aspx')", true);
                                }
                                else
                                {
                                    this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "showAlert('Some Error Occured!','info','../WMS/Transfer.aspx')", true);
                                }
                            }
                            Outbound.ClearTempDataFromDBPickUp(HttpContext.Current.Session.SessionID, profile.Personal.UserID.ToString(), ObjectName, profile.DBConnection._constr);
                        }
                    }
                }
                else
                {
                    this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "showAlert('One or More Product Dones Not Assigned The Location. Please Assign the Location For Product... ','erroe','#')", true);
                }
            }
            catch (Exception ex)
            {
                this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "showAlert('" + ex.Message.ToString() + "','Error','#')", true);
            }
            finally
            {
                Outbound.Close();
            }
        }