public void GetSku()
 {
     try
     {
         if (!string.IsNullOrEmpty(Session["CODE_WAREHOUSE"].ToString()))
         {
             var objInventory = new WSInventory.SwiftExpressWSInventory();
             //WSIncome.SwiftExpressWSIncome objIncome = new WSIncome.SwiftExpressWSIncome();
             var pResult = "";
             var ds      = objInventory.GetStockForPicking(Session["CODE_WAREHOUSE"].ToString(), Session["connectionString"].ToString(), ref pResult);
             //ds = objIncome.getSKU(Session["connectionString"].ToString());
             if (pResult == "")
             {
                 ASPxGridLookup3.DataSource = ds;
                 ASPxGridLookup3.DataBind();
                 Session["PICKINGSKU"] = ds;
             }
             else
             {
                 ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('" + pResult + "');",
                                                     true);
             }
             objInventory.Dispose();
         }
     }
     catch (Exception ex)
     {
         ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: " + ex.Message + "');", true);
     }
 }
        protected void UIBotonCancelarBodega_Click(object sender, EventArgs e)
        {
            Session["CODE_WAREHOUSE"] = "";

            UiListaBodega.Value    = null;
            UiListaBodegaErp.Value = null;

            UiListaBodega.Enabled    = true;
            UiListaBodegaErp.Enabled = true;

            UiPopupConfirmarcionBodega.ShowOnPageLoad = false;

            Session["PICKINGSKU"]      = null;
            ASPxGridLookup3.DataSource = Session["PICKINGSKU"];
            ASPxGridLookup3.DataBind();
        }
 public void GetAllRoute()
 {
     try
     {
         var pResult = "";
         var ds      = _wsCalled.GetAllRoute(Session["connectionString"].ToString(), ref pResult);
         if (pResult == "")
         {
             Session["DsRoutes"]        = ds;
             ASPxGridLookup3.DataSource = ds;
             ASPxGridLookup3.DataBind();
         }
         else
         {
             ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('" + pResult + "');", true);
         }
     }
     catch (Exception ex)
     {
         ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: " + ex.Message + "');", true);
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!ValidarConexionYUsuarioLogueado(sender))
            {
                return;
            }
            if (!Page.IsPostBack)
            {
                try
                {
                    Session["GridPicking"]         = null;
                    Session["GridManifiesto"]      = null;
                    Session["DsDriver"]            = null;
                    Session["DsVehicle"]           = null;
                    Session["DsRoutes"]            = null;
                    Session["UiListaRuta"]         = null;
                    ASPxGridLookup1.GridView.Width = 300;
                    ASPxGridLookup2.GridView.Width = 300;
                    ASPxGridLookup3.GridView.Width = 300;
                    GetPicking();
                    GetDriver();
                    GetAllRoute();
                    GetVehicle();
                }
                catch (Exception ex)
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText",
                                                        "CallError('Error: " + ex.Message + "');", true);
                }
            }
            try
            {
                if (Session["UiListaRuta"] != null)
                {
                    UiListaRuta.DataSource = Session["UiListaRuta"];
                    UiListaRuta.DataBind();
                }
                else
                {
                    LlenarListaRuta();
                }

                if (Session["DsDriver"] != null)
                {
                    ASPxGridLookup1.DataSource = Session["dsDriver"];
                    ASPxGridLookup1.DataBind();
                }
                else
                {
                    GetDriver();
                }
                if (Session["DsVehicle"] != null)
                {
                    ASPxGridLookup2.DataSource = Session["DsVehicle"];
                    ASPxGridLookup2.DataBind();
                }
                else
                {
                    GetVehicle();
                }

                if (Session["DsRoutes"] != null)
                {
                    ASPxGridLookup3.DataSource = Session["DsRoutes"];
                    ASPxGridLookup3.DataBind();
                }
                else
                {
                    GetAllRoute();
                }
                if (Session["GridPicking"] != null)
                {
                    ASPxGridView1.DataSource = Session["GridPicking"];
                    ASPxGridView1.DataBind();
                    ReportViewer();
                }
                else
                {
                    GetPicking();
                }
                if (Session["GridManifiesto"] == null)
                {
                    return;
                }
                ASPxGridView2.DataSource = Session["GridManifiesto"];
                ASPxGridView2.DataBind();
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText",
                                                    "CallError('Error: " + ex.Message + "');", true);
            }
        }
        protected void AspxMenu1_ItemClick(object source, DevExpress.Web.MenuItemEventArgs e)
        {
            try
            {
                switch (e.Item.Name)
                {
                case "btnUpdateOrInsert":
                    //?Actualizar o insertar en base a la variable de sesion que lo indica
                    if ((string)Session["UPDATE_TEMP_PICKING"] == "true")
                    {
                        _result = _wscalled.UpdateDetailPicking((int)Session["PICKING_DETAIL"], Convert.ToString(ASPxGridLookup3.Value), Convert.ToString(ASPxGridLookup3.Text), Convert.ToInt32(ASPxSpinEdit1.Number), Session["connectionString"].ToString());
                        Session["UPDATE_TEMP_PICKING"] = "false";
                        Session["DISPATCH"]            = ASPxSpinEdit1.Number;
                        var pResult  = "";
                        var dsDetail = _wscalled.GetPickingDetailForPickingHeader((int)Session["Header_picking"], Session["connectionString"].ToString(), ref pResult);
                        if (pResult == "")
                        {
                            ASPxGridView1.DataSource = dsDetail;
                            ASPxGridView1.DataBind();
                            Session["SavePicking"] = "true";
                        }
                        else
                        {
                            ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('" + pResult + "');", true);
                        }
                    }
                    else
                    {
                        ASPxPopupControl1.ShowOnPageLoad = true;
                    }
                    break;

                case "btnInsert":

                    if ((string)Session["SavePicking"] == "false")
                    {
                        //ASPxPopupControl2.ShowOnPageLoad = true;
                        //ASPxPopupControl2.HeaderText = "Es necesario almacenar la Recepcion";
                        ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Es necesario almacenar el picking');", true);
                    }
                    else
                    {
                        Session["INGRESO_HEADER_PICKING"] = "false";
                        ASPxSpinEdit2.Text       = "";
                        ASPxSpinEdit3.Text       = "";
                        ASPxComboBox1.Text       = "";
                        ASPxGridLookup1.Text     = "";
                        ASPxGridLookup2.Text     = "";
                        ASPxGridLookup3.Text     = "";
                        ASPxSpinEdit1.Number     = 0;
                        ASPxGridView1.DataSource = null;
                        ASPxGridView1.DataBind();
                        ASPxGridLookup3.Text       = "";
                        ASPxSpinEdit1.Number       = 0;
                        Session["CODE_WAREHOUSE"]  = "";
                        UiListaBodega.Enabled      = true;
                        UiListaBodegaErp.Enabled   = true;
                        Session["PICKINGSKU"]      = null;
                        ASPxGridLookup3.DataSource = Session["PICKINGSKU"];
                        ASPxGridLookup3.DataBind();
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: " + ex.Message + "');", true);
            }
        }