Exemplo n.º 1
0
        public static int WMChangeStatus(string SelectedRec)
        {
            int Result = 0;

            BrilliantWMS.WMSOutbound.iOutboundClient Outbound = new WMSOutbound.iOutboundClient();
            try
            {
                CustomProfile profile = CustomProfile.GetProfile();
                Result = Outbound.ChangeStatusToMarkForReturn(SelectedRec, profile.Personal.UserID, profile.DBConnection._constr);

                BrilliantWMS.WMSOutbound.tReturnHead rtrn = new WMSOutbound.tReturnHead();
                string[] OrdrCnt   = SelectedRec.Split(',');
                int      TotOrdres = OrdrCnt.Count();
                for (int i = 0; i <= TotOrdres - 1; i++)
                {
                    rtrn.SONo         = long.Parse(OrdrCnt[i].ToString());
                    rtrn.ReturnBy     = profile.Personal.UserID;
                    rtrn.ReturnDate   = DateTime.Now;
                    rtrn.CreatedBy    = profile.Personal.UserID;
                    rtrn.CreationDate = DateTime.Now;
                    rtrn.Status       = 49;

                    long rtrnID = Outbound.SaveReturnHead(rtrn, profile.DBConnection._constr);
                }
            }
            catch { }
            finally { Outbound.Close(); }

            return(Result);
        }
        public static int WMCheckStatus(string SelectedSO)
        {
            int Result = 0;

            BrilliantWMS.WMSInbound.iInboundClient Inbound = new WMSInbound.iInboundClient();
            //iInboundClient Inbound = new iInboundClient();
            try
            {
                CustomProfile profile   = CustomProfile.GetProfile();
                bool          exeresult = Inbound.CheckJobCardofSelectedRecord(SelectedSO, "SalesOrder", profile.DBConnection._constr);
                if (exeresult == true)
                {
                    BrilliantWMS.WMSOutbound.iOutboundClient Outbound = new WMSOutbound.iOutboundClient();
                    Result = Outbound.CheckSelectedSOStatusIsSameOrNot(SelectedSO, profile.DBConnection._constr);
                    Page objp = new Page();
                    objp.Session["SelectedRec"] = SelectedSO; objp.Session["ObjectName"] = "SalesOrder";
                }
                else
                {
                    Result = 2;
                }
            }
            catch { }
            finally { Inbound.Close(); }
            return(Result);
        }
        public void bindgrid()
        {
            BrilliantWMS.WMSOutbound.iOutboundClient Outbound = new WMSOutbound.iOutboundClient();
            try
            {
                CustomProfile profile = CustomProfile.GetProfile();
                DataSet       ds      = new DataSet();
                string        role    = profile.Personal.UserType.ToString();
                if (role == "Super Admin" || role == "Admin" || role == "Warehouse Admin")
                {
                    long userCompany = profile.Personal.CompanyID;
                    ds = Outbound.BindOutboundGrid(userCompany, profile.DBConnection._constr);
                }
                else
                {
                    ds = Outbound.BindOutboundGridbyUser(profile.Personal.UserID, profile.DBConnection._constr);
                }
                grdSalesOrder.DataSource = ds;
                grdSalesOrder.DataBind();

                grdSalesOrder.AllowMultiRecordSelection = true;
                grdSalesOrder.AllowRecordSelection      = true;
            }
            catch { }
            finally { Outbound.Close(); }
        }
        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 void BindGrid()
        {
            BrilliantWMS.WMSOutbound.iOutboundClient Outbound = new WMSOutbound.iOutboundClient();
            try
            {
                CustomProfile profile = CustomProfile.GetProfile();
                if (Session["SOID"] != null)
                {
                    hdnPickUpNo.Value      = Session["SOID"].ToString();
                    GridReceipt.DataSource = Outbound.GetPickUpList(Session["SOID"].ToString(), "", Session.SessionID, profile.Personal.UserID.ToString(), ObjectName, profile.DBConnection._constr);
                    GridReceipt.DataBind();
                }
                else if (Session["PKUPID"] != null)
                {
                    long pkupId = long.Parse(Session["PKUPID"].ToString());
                    long soID   = Outbound.GetSOIDfromPkUpID(pkupId, profile.DBConnection._constr); hdnPickUpNo.Value = soID.ToString();

                    GridReceipt.DataSource = Outbound.GetPickUpList(soID.ToString(), "", Session.SessionID, profile.Personal.UserID.ToString(), ObjectName, profile.DBConnection._constr);
                    GridReceipt.DataBind();
                }
                if (Session["SOstate"] != null)
                {
                    if (Session["SOstate"].ToString() == "View")
                    {
                        BtnSequence.Visible = false;
                    }
                }
                else if (Session["PKUPstate"] != null)
                {
                    if (Session["PKUPstate"].ToString() == "View")
                    {
                        BtnSequence.Visible = false;
                    }
                }
                else
                {
                    BtnSequence.Visible = true;
                }

                if (Session["TRID"] != null)
                {
                    GridReceipt.DataSource = Outbound.GetPickUpList("", Session["TRID"].ToString(), Session.SessionID, profile.Personal.UserID.ToString(), ObjectName, profile.DBConnection._constr);
                    GridReceipt.DataBind();
                    if (Session["TRstate"].ToString() == "View")
                    {
                        BtnSequence.Visible = false;
                    }
                }
            }
            catch { }
            finally { Outbound.Close(); }
        }
Exemplo n.º 6
0
        public void GetTransferDetails(string TransferID)
        {
            long TRID = long.Parse(TransferID);

            BrilliantWMS.WMSOutbound.iOutboundClient Outbound = new WMSOutbound.iOutboundClient();
            BrilliantWMS.WMSInbound.iInboundClient   Inbound  = new WMSInbound.iInboundClient();
            CustomProfile                  profile            = CustomProfile.GetProfile();
            iUCCommonFilterClient          objService         = new iUCCommonFilterClient();
            List <vGetUserProfileByUserID> UsersList          = new List <vGetUserProfileByUserID>();

            try
            {
                BrilliantWMS.WMSOutbound.tTransferHead trh = new WMSOutbound.tTransferHead();  //= new tTransferHead();
                trh = Outbound.GetTransferHeadDetailByTransferID(TRID, profile.DBConnection._constr);

                lblWTWTransferNo.Text  = trh.ID.ToString();
                UCWTWTransferDate.Date = trh.TransferDate;

                fillUser();
                ddlWTWTransferBy.SelectedIndex = ddlWTWTransferBy.Items.IndexOf(ddlWTWTransferBy.Items.FindByValue(trh.TransferBy.ToString()));

                ddlWTWStatus.DataSource = WMFillStatus();
                ddlWTWStatus.DataBind();
                ddlWTWStatus.SelectedIndex = ddlWTWStatus.Items.IndexOf(ddlWTWStatus.Items.FindByValue(trh.Status.ToString()));

                fillWarehouse();
                ddlFWarehouse.SelectedIndex = ddlFWarehouse.Items.IndexOf(ddlFWarehouse.Items.FindByValue(trh.FromPosition.ToString()));

                List <BrilliantWMS.WMSInbound.mWarehouseMaster> ToWarehouseList = new List <WMSInbound.mWarehouseMaster>();
                long UserID = profile.Personal.UserID;
                ToWarehouseList          = Inbound.GetUserWarehouse(UserID, profile.DBConnection._constr).ToList();
                ddlTWarehouse.DataSource = ToWarehouseList;
                ddlTWarehouse.DataBind();
                ddlTWarehouse.SelectedIndex = ddlTWarehouse.Items.IndexOf(ddlTWarehouse.Items.FindByValue(trh.ToPosition.ToString()));

                WTWTRemark.Text         = trh.Remark.ToString();
                txtAirwayBill.Text      = trh.AirwayBill.ToString();
                txtShippingType.Text    = trh.ShippingType.ToString();
                UC_ShippingDate.Date    = trh.ShippingDate;
                UCExpDeliveryDate.Date  = trh.ExpDeliveryDate;
                txtTransporterName.Text = trh.TransporterName.ToString();

                Grid1.DataSource = Outbound.GetTransferPartDetailByTransferID(TRID, long.Parse(trh.FromPosition.ToString()), Session.SessionID, profile.Personal.UserID.ToString(), ObjectName, profile.DBConnection._constr);
                Grid1.DataBind();
                ScriptManager.RegisterStartupScript(this, this.GetType(), "changemodeRequest" + Session.SessionID, "changemode(true, 'divWTWTransferDetail');LoadingOff();", true);
            }
            catch { }
            finally { Outbound.Close(); objService.Close(); UsersList.Clear(); }
        }
Exemplo n.º 7
0
        public void bindgrid()
        {
            BrilliantWMS.WMSOutbound.iOutboundClient Outbound = new WMSOutbound.iOutboundClient();
            try
            {
                CustomProfile profile = CustomProfile.GetProfile();
                DataSet       ds      = new DataSet();
                ds = Outbound.BindOutboundGridForReturn(profile.DBConnection._constr);
                grdSalesOrder.DataSource = ds;
                grdSalesOrder.DataBind();

                grdSalesOrder.AllowMultiRecordSelection = true;
                grdSalesOrder.AllowRecordSelection      = true;
            }
            catch { }
            finally { Outbound.Close(); }
        }
Exemplo n.º 8
0
        public static int WMRemovePartFromRequest(Int32 Sequence)
        {
            int editOrder = 0;

            BrilliantWMS.WMSOutbound.iOutboundClient Outbound = new WMSOutbound.iOutboundClient();
            CustomProfile profile = CustomProfile.GetProfile();

            try
            {
                Dictionary <string, object> dictionary = new Dictionary <string, object>();
                Outbound.RemovePartFromTransfer_TempDataTR(HttpContext.Current.Session.SessionID, profile.Personal.UserID.ToString(), ObjectName, Sequence, profile.DBConnection._constr);
                editOrder = 1;
            }
            catch (System.Exception ex)
            {
                Login.Profile.ErrorHandling(ex, "WToWTransferDetail.aspx", "WMRemovePartFromRequest");
            }
            finally { Outbound.Close(); }
            return(editOrder);
        }
Exemplo n.º 9
0
        public static void WMUpdTransferPart(object objTransfer)
        {
            BrilliantWMS.WMSOutbound.iOutboundClient Outbound = new WMSOutbound.iOutboundClient();
            BrilliantWMS.WMSInbound.iInboundClient   Inbound  = new WMSInbound.iInboundClient();
            try
            {
                Dictionary <string, object> dictionary = new Dictionary <string, object>();
                dictionary = (Dictionary <string, object>)objTransfer;
                CustomProfile profile = CustomProfile.GetProfile();

                string uom = Inbound.GetUOMName(Convert.ToInt64(dictionary["UOMID"]), profile.DBConnection._constr);

                BrilliantWMS.WMSOutbound.WMS_SP_GetPartDetail_ForTransfer_Result PartTransfer = new WMSOutbound.WMS_SP_GetPartDetail_ForTransfer_Result();

                PartTransfer.Sequence = Convert.ToInt64(dictionary["Sequence"]);
                PartTransfer.Qty      = Convert.ToDecimal(dictionary["Qty"]); //PartRequest.UOM = uom;
                PartTransfer.UOMID    = Convert.ToInt64(dictionary["UOMID"]);

                Outbound.UpdateTransfer_TempDataTR(HttpContext.Current.Session.SessionID, ObjectName, profile.Personal.UserID.ToString(), PartTransfer, profile.DBConnection._constr);
            }
            catch (System.Exception ex) { Login.Profile.ErrorHandling(ex, "WToWTransferDetail.aspx", "WMUpdRequestPart"); }
            finally { Outbound.Close(); }
        }
Exemplo n.º 10
0
 protected void Grid1_OnRebind(object sender, EventArgs e)
 {
     BrilliantWMS.WMSOutbound.iOutboundClient Outbound = new WMSOutbound.iOutboundClient();
     try
     {
         Grid1.DataSource = null;
         Grid1.DataBind();
         CustomProfile profile = CustomProfile.GetProfile();
         HiddenField   hdn     = (HiddenField)UCProductSearchWTW.FindControl("hdnProductSearchSelectedRec");
         List <BrilliantWMS.WMSOutbound.WMS_SP_GetPartDetail_ForTransfer_Result> TRPartList = new List <WMSOutbound.WMS_SP_GetPartDetail_ForTransfer_Result>();
         if (hdn.Value == "")
         {
             TRPartList = Outbound.GetExistingTempDataBySessionIDObjectNameTR(Session.SessionID, profile.Personal.UserID.ToString(), ObjectName, profile.DBConnection._constr).ToList();
         }
         else if (hdn.Value != "")
         {
             TRPartList = Outbound.AddPartIntoTransfer_TempDataTR(hdn.Value, Session.SessionID, profile.Personal.UserID.ToString(), ObjectName, Convert.ToInt32(hdnFrmWarehouse.Value), profile.DBConnection._constr).ToList();
         }
         Grid1.DataSource = TRPartList;
         Grid1.DataBind();
     }
     catch (System.Exception ex) { Login.Profile.ErrorHandling(ex, this, "WToWTransferDetail.aspx", "Grid1_OnRebind"); }
     finally { Outbound.Close(); }
 }
Exemplo n.º 11
0
        public void FillObjectList(string SelectedRecords, string ObjectName)
        {
            CustomProfile profile = CustomProfile.GetProfile();

            BrilliantWMS.WMSInbound.iInboundClient Inbound = new WMSInbound.iInboundClient();
            //iInboundClient Inbound = new iInboundClient();
            iUCCommonFilterClient          objService = new iUCCommonFilterClient();
            List <vGetUserProfileByUserID> UsersList  = new List <vGetUserProfileByUserID>();

            try
            {
                DataSet ds = new DataSet();
                ds = Inbound.GetNextObject(SelectedRecords, ObjectName, profile.Personal.CompanyID, profile.DBConnection._constr);
                ddlObjectName.DataSource = ds;
                ddlObjectName.DataBind();
                long     WarehouseID = 0;
                string[] onePo = SelectedRecords.Split(','); long POID = 0;
                if (ObjectName == "PurchaseOrder")
                {
                    POID = long.Parse(onePo[0].ToString());
                    BrilliantWMS.WMSInbound.tPurchaseOrderHead POHead = new WMSInbound.tPurchaseOrderHead();
                    //tPurchaseOrderHead POHead = new tPurchaseOrderHead();
                    POHead      = Inbound.GetPoHeadByPOID(POID, profile.DBConnection._constr);
                    WarehouseID = long.Parse(POHead.Warehouse.ToString());
                }
                else if (ObjectName == "GRN")
                {
                    long GRNID = long.Parse(onePo[0].ToString());
                    BrilliantWMS.WMSInbound.WMS_VW_GetGRNDetails GrnLst = new WMSInbound.WMS_VW_GetGRNDetails();
                    //WMS_VW_GetGRNDetails GrnLst = new WMS_VW_GetGRNDetails();
                    GrnLst = Inbound.GetGRNDetailsByGRNIDGRNMenu(GRNID, profile.DBConnection._constr);
                    POID   = long.Parse(GrnLst.OID.ToString());

                    BrilliantWMS.WMSInbound.tPurchaseOrderHead POHead = new WMSInbound.tPurchaseOrderHead();
                    //tPurchaseOrderHead POHead = new tPurchaseOrderHead();
                    POHead      = Inbound.GetPoHeadByPOID(POID, profile.DBConnection._constr);
                    WarehouseID = long.Parse(POHead.Warehouse.ToString());
                }
                else if (ObjectName == "QC")
                {
                    long QCID = long.Parse(onePo[0].ToString());
                    BrilliantWMS.WMSInbound.WMS_VW_GetQCDetails QClist = new WMSInbound.WMS_VW_GetQCDetails();
                    //WMS_VW_GetQCDetails QClist = new WMS_VW_GetQCDetails();
                    QClist      = Inbound.GetQCDetailsByQCID(QCID, profile.DBConnection._constr);
                    WarehouseID = long.Parse(QClist.WarehouseID.ToString());
                }
                else if (ObjectName == "SalesOrder")
                {
                    long SOID = long.Parse(onePo[0].ToString());
                    BrilliantWMS.WMSOutbound.iOutboundClient Outbound = new WMSOutbound.iOutboundClient();
                    BrilliantWMS.WMSOutbound.tOrderHead      soHead   = new WMSOutbound.tOrderHead();
                    //tOrderHead soHead = new tOrderHead();
                    soHead      = Outbound.GetSoHeadBySOID(SOID, profile.DBConnection._constr);
                    WarehouseID = long.Parse(soHead.StoreId.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);
                ddlAssignTo.DataSource = UsersList;
                ddlAssignTo.DataBind();
            }
            catch { }
            finally { Inbound.Close(); }
            //if (Request.QueryString["invoker"] != null) CurrentObject = Request.QueryString["invoker"].ToString();
            //UCAssignTaskService.iUCAssignTaskClient ucAssignTaskService = new UCAssignTaskService.iUCAssignTaskClient();
            //ddlObjectName.DataSource = ucAssignTaskService.GetObjectToBind(CurrentObject, profile.DBConnection._constr);
            //ddlObjectName.DataBind();
            //ucAssignTaskService.Close();
        }
        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(); }
        }
        public void GetDispatchDetails(string QCID)
        {
            long selQCID = 0;

            BrilliantWMS.WMSOutbound.iOutboundClient Outbound = new WMSOutbound.iOutboundClient();
            CustomProfile                  profile            = CustomProfile.GetProfile();
            iUCCommonFilterClient          objService         = new iUCCommonFilterClient();
            List <vGetUserProfileByUserID> UsersList          = new List <vGetUserProfileByUserID>();

            try
            {
                if (Session["QCID"] != null)
                {
                    selQCID = long.Parse(QCID.ToString());
                    BrilliantWMS.WMSOutbound.WMS_VW_GetDispatchDetails dispatchLst = new WMSOutbound.WMS_VW_GetDispatchDetails();
                    dispatchLst = Outbound.GetDispatchDetailsByQCID(selQCID, profile.DBConnection._constr);

                    lblDispatchNo.Text        = dispatchLst.ID.ToString();
                    UCDispatchDate.Date       = dispatchLst.DispatchDate;
                    txtRemark.Text            = dispatchLst.Remark.ToString();
                    txtAirwayBill.Text        = dispatchLst.AirwayBill.ToString();
                    txtShippingType.Text      = dispatchLst.ShippingType.ToString();
                    UC_ShippingDate.Date      = dispatchLst.ShippingDate;
                    UCExpDeliveryDate.Date    = dispatchLst.ExpDeliveryDate;
                    txtTransporterName.Text   = dispatchLst.TransporterName.ToString();
                    txtTransporterRemark.Text = dispatchLst.TransporterRemark.ToString();
                    long WarehouseID = long.Parse(dispatchLst.StoreId.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();
                    ddlDispatchBy.SelectedIndex = ddlDispatchBy.Items.IndexOf(ddlDispatchBy.Items.FindByValue(dispatchLst.DispatchBy.ToString()));

                    ddlStatus.DataSource = WMFillStatus();
                    ddlStatus.DataBind();
                    ddlStatus.SelectedIndex = ddlStatus.Items.IndexOf(ddlStatus.Items.FindByValue(dispatchLst.Status.ToString()));

                    Grid1.DataSource = Outbound.GetDispatchSkuDetailByDispatchID(long.Parse(dispatchLst.ID.ToString()), profile.DBConnection._constr);
                    Grid1.DataBind();
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "changemodeRequest" + Session.SessionID, "changemode(true, 'dvDDetail');LoadingOff();", true);
                }
                else if (Session["DispID"] != null)
                {
                    selQCID = long.Parse(QCID.ToString());
                    BrilliantWMS.WMSOutbound.WMS_VW_GetDispatchDetails dispatchLst = new WMSOutbound.WMS_VW_GetDispatchDetails();
                    dispatchLst               = Outbound.GetDispatchDetailsByDispatchID(selQCID, profile.DBConnection._constr);
                    lblDispatchNo.Text        = dispatchLst.ID.ToString();
                    UCDispatchDate.Date       = dispatchLst.DispatchDate;
                    txtRemark.Text            = dispatchLst.Remark.ToString();
                    txtAirwayBill.Text        = dispatchLst.AirwayBill.ToString();
                    txtShippingType.Text      = dispatchLst.ShippingType.ToString();
                    UC_ShippingDate.Date      = dispatchLst.ShippingDate;
                    UCExpDeliveryDate.Date    = dispatchLst.ExpDeliveryDate;
                    txtTransporterName.Text   = dispatchLst.TransporterName.ToString();
                    txtTransporterRemark.Text = dispatchLst.TransporterRemark.ToString();
                    long WarehouseID = long.Parse(dispatchLst.StoreId.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();
                    ddlDispatchBy.SelectedIndex = ddlDispatchBy.Items.IndexOf(ddlDispatchBy.Items.FindByValue(dispatchLst.DispatchBy.ToString()));

                    ddlStatus.DataSource = WMFillStatus();
                    ddlStatus.DataBind();
                    ddlStatus.SelectedIndex = ddlStatus.Items.IndexOf(ddlStatus.Items.FindByValue(dispatchLst.Status.ToString()));

                    Grid1.DataSource = Outbound.GetDispatchSkuDetailByDispatchID(long.Parse(dispatchLst.ID.ToString()), profile.DBConnection._constr);
                    Grid1.DataBind();
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "changemodeRequest" + Session.SessionID, "changemode(true, 'dvDDetail');LoadingOff();", true);
                }
                else if (Session["TRID"] != null)
                {
                    selQCID = long.Parse(QCID.ToString());
                    BrilliantWMS.WMSOutbound.WMS_VW_GetDispatchDetails dispatchLst = new WMSOutbound.WMS_VW_GetDispatchDetails();
                    dispatchLst = Outbound.GetDispatchDetailsByQCID(selQCID, profile.DBConnection._constr);

                    lblDispatchNo.Text        = dispatchLst.ID.ToString();
                    UCDispatchDate.Date       = dispatchLst.DispatchDate;
                    txtRemark.Text            = dispatchLst.Remark.ToString();
                    txtAirwayBill.Text        = dispatchLst.AirwayBill.ToString();
                    txtShippingType.Text      = dispatchLst.ShippingType.ToString();
                    UC_ShippingDate.Date      = dispatchLst.ShippingDate;
                    UCExpDeliveryDate.Date    = dispatchLst.ExpDeliveryDate;
                    txtTransporterName.Text   = dispatchLst.TransporterName.ToString();
                    txtTransporterRemark.Text = dispatchLst.TransporterRemark.ToString();
                    long WarehouseID = long.Parse(dispatchLst.StoreId.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();
                    ddlDispatchBy.SelectedIndex = ddlDispatchBy.Items.IndexOf(ddlDispatchBy.Items.FindByValue(dispatchLst.DispatchBy.ToString()));

                    ddlStatus.DataSource = WMFillStatus();
                    ddlStatus.DataBind();
                    ddlStatus.SelectedIndex = ddlStatus.Items.IndexOf(ddlStatus.Items.FindByValue(dispatchLst.Status.ToString()));

                    Grid1.DataSource = Outbound.GetDispatchSkuDetailByDispatchID(long.Parse(dispatchLst.ID.ToString()), profile.DBConnection._constr);
                    Grid1.DataBind();
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "changemodeRequest" + Session.SessionID, "changemode(true, 'dvDDetail');LoadingOff();", true);
                }
            }
            catch { }
            finally { Outbound.Close(); objService.Close(); UsersList.Clear(); }
        }
        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);
        }
        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();
            }
        }
Exemplo n.º 16
0
        public static long WMSaveTransferHead(object objTRHead)
        {
            long result = 0;
            int  RSLT = 0; long TRID = 0;

            BrilliantWMS.WMSOutbound.iOutboundClient Outbound = new WMSOutbound.iOutboundClient();
            try
            {
                CustomProfile profile = CustomProfile.GetProfile();
                BrilliantWMS.WMSOutbound.tTransferHead trH = new WMSOutbound.tTransferHead();
                Dictionary <string, object>            d   = new Dictionary <string, object>();
                d = (Dictionary <string, object>)objTRHead;
                if (HttpContext.Current.Session["TRID"] != null)
                {
                    if (HttpContext.Current.Session["TRID"].ToString() == "0")
                    {
                        trH.CreatedBy    = profile.Personal.UserID;
                        trH.CreationDate = DateTime.Now;
                    }
                    else
                    {
                        trH.ID         = Convert.ToInt64(HttpContext.Current.Session["TRID"].ToString());
                        trH.Modifiedby = profile.Personal.UserID;
                        trH.ModiedDate = DateTime.Now;
                    }
                    trH.Type         = 2;
                    trH.TransferDate = Convert.ToDateTime(d["TransferDate"]);
                    trH.FromPosition = Convert.ToInt64(d["FromPosition"]);
                    trH.ToPosition   = Convert.ToInt64(d["ToPosition"]);
                    trH.TransferBy   = Convert.ToInt64(d["TransferBy"]);
                    trH.Status       = Convert.ToInt64(d["Status"]);
                    trH.Remark       = d["Remark"].ToString();
                    trH.CompanyID    = profile.Personal.CompanyID;

                    trH.AirwayBill      = d["AirwayBill"].ToString();
                    trH.ShippingType    = d["ShippingType"].ToString();
                    trH.TransporterName = d["TransporterName"].ToString();
                    trH.ShippingDate    = Convert.ToDateTime(d["ShippingDate"]);
                    trH.ExpDeliveryDate = Convert.ToDateTime(d["ExpDeliveryDate"]);
                    trH.ObjectName      = "Transfer";

                    TRID = Outbound.SaveIntotTransferHead(trH, profile.DBConnection._constr);
                    if (TRID > 0)
                    {
                        RSLT = Outbound.FinalSaveTRDetail(HttpContext.Current.Session.SessionID, ObjectName, TRID, profile.Personal.UserID.ToString(), Convert.ToInt16(trH.Status), 0, profile.DBConnection._constr);
                        if (RSLT == 1 || RSLT == 2)
                        {
                            result = TRID;
                        }                                               //"Request saved successfully";
                        else if (RSLT == 3)
                        {
                            result = -3;
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                Login.Profile.ErrorHandling(ex, "WToWTransferDetail.aspx", "WMSaveRequestHead");
                result = 0; // "Some error occurred";
            }
            finally
            {
                Outbound.Close();
            }
            return(result);
        }
        protected void UpdateRecord(object sender, Obout.Grid.GridRecordEventArgs e)
        {
            UCApplyTaxService.iUCApplyTaxClient ApplyTaxServie = new UCApplyTaxService.iUCApplyTaxClient();
            try
            {
                CustomProfile profile = CustomProfile.GetProfile();
                object        key     = "Save";
                if (e.Record[key].ToString() == "N")
                {
                    string ProductID = Request.QueryString["PrdID"].ToString();
                    if (ProductID == "undefined")
                    {
                        ProductID = "0";
                    }
                    long PrdID = Convert.ToInt64(ProductID);
                    List <SP_CartBeforeUpdateProductLevelTaxDetail_Result> lst = new List <SP_CartBeforeUpdateProductLevelTaxDetail_Result>();
                    // lst = ApplyTaxServie.GetCalculatedTaxListBeforeUpdate(Request.QueryString["Object"].ToString(), Session.SessionID, Convert.ToInt64(Request.QueryString["CartSeq"].ToString()), Convert.ToDecimal(lblTaxableAmount.Text), hdnTaxSelectedRec.Value.ToString(), profile.DBConnection._constr).ToList();
                    lst = ApplyTaxServie.GetCalculatedTaxListBeforeUpdate(Request.QueryString["Object"].ToString(), Session.SessionID, PrdID, Convert.ToDecimal(lblTaxableAmount.Text), hdnTaxSelectedRec.Value.ToString(), profile.DBConnection._constr).ToList();
                    ApplyTaxServie.Close();
                    GridTaxList.DataSource = lst;
                    GridTaxList.DataBind();
                }
                else if (e.Record[key].ToString() == "Save")
                {
                    string TotalTaxAmount = UpdateTaxAmount();
                    ApplyTaxServie.Close();

                    string obj = Request.QueryString["Object"].ToString();
                    if (obj == "PurchaseOrderTax")
                    {
                        BrilliantWMS.WMSInbound.iInboundClient Inbound = new WMSInbound.iInboundClient();
                        //iInboundClient Inbound = new iInboundClient();
                        BrilliantWMS.WMSInbound.WMS_SP_GetPartDetail_ForPO_Result PartRequest = new WMSInbound.WMS_SP_GetPartDetail_ForPO_Result();
                        //WMS_SP_GetPartDetail_ForPO_Result PartRequest = new WMS_SP_GetPartDetail_ForPO_Result();
                        PartRequest.Sequence       = Convert.ToInt64(Request.QueryString["CartSeq"].ToString());
                        PartRequest.TotalTaxAmount = Convert.ToDecimal(TotalTaxAmount);
                        decimal TtlAftrtax = Convert.ToDecimal(TotalTaxAmount) + Convert.ToDecimal(Request.QueryString["TaxableAmt"].ToString());
                        PartRequest.AmountAfterTax = TtlAftrtax;
                        //string obj = Request.QueryString["Object"].ToString();
                        // if (obj == "PurchaseOrderTax")
                        obj = "PurchaseOrder";
                        // else obj = "SalesOrderTax";
                        Inbound.UpdatePartRequest_TempData13(Session.SessionID, obj, profile.Personal.UserID.ToString(), PartRequest, profile.DBConnection._constr);
                        Inbound.Close();
                    }
                    else if (obj == "SalesOrderTax")
                    {
                        BrilliantWMS.WMSOutbound.iOutboundClient Outbound = new WMSOutbound.iOutboundClient();
                        BrilliantWMS.WMSOutbound.WMS_SP_GetPartDetail_ForSO_Result PartRSO = new WMSOutbound.WMS_SP_GetPartDetail_ForSO_Result();
                        PartRSO.Sequence       = Convert.ToInt64(Request.QueryString["CartSeq"].ToString());
                        PartRSO.TotalTaxAmount = Convert.ToDecimal(TotalTaxAmount);
                        decimal TtlAftrtax = Convert.ToDecimal(TotalTaxAmount) + Convert.ToDecimal(Request.QueryString["TaxableAmt"].ToString());
                        PartRSO.AmountAfterTax = TtlAftrtax;
                        obj = "SalesOrder";
                        Outbound.UpdatePartRequest_TempData13SO(Session.SessionID, obj, profile.Personal.UserID.ToString(), PartRSO, profile.DBConnection._constr);
                        Outbound.Close();
                    }
                }
            }
            catch (System.Exception ex)
            {
                Login.Profile.ErrorHandling(ex, this, "UCApplyTax", "UpdateRecord");
            }
            finally
            {   }
        }