public void GetOperator()
        {
            try
            {
                var objIncome = new WSIncome.SwiftExpressWSIncome();
                var pResult   = "";

                var ds = objIncome.GetOperator(Session["connectionString"].ToString(), ref pResult);
                if (pResult == "")
                {
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        ASPxGridLookup2.DataSource = ds;
                        //ASPxGridLookup1.TextField = "NAME_CLASSIFICATION";
                        //ASPxGridLookup1.ValueField = "CLASSIFICATION";

                        ASPxGridLookup2.DataBind();
                    }
                    Session["OPERATOR"] = ds;
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('" + pResult + "');", true);
                }
                objIncome.Dispose();
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: " + ex.Message + "');", true);
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (ValidarConexionYUsuarioLogueado(sender))
     {
         try
         {
             if (!Page.IsPostBack)
             {
                 GetCustomer();
                 GetBranches();
                 GetRoute();
             }
             else
             {
                 if (Session["dsCustomerBranch"] != null)
                 {
                     ASPxGridLookup1.DataSource = Session["dsCustomerBranch"];
                     ASPxGridLookup1.DataBind();
                 }
                 else
                 {
                     GetCustomer();
                 }
                 if (Session["dsRouteBranch"] != null)
                 {
                     ASPxGridLookup2.DataSource = Session["dsRouteBranch"];
                     ASPxGridLookup2.DataBind();
                 }
                 else
                 {
                     GetRoute();
                 }
                 if (Session["dsBranch"] != null)
                 {
                     ASPxGridView1.DataSource = Session["dsBranch"];
                     ASPxGridView1.DataBind();
                     ReportView();
                 }
                 else
                 {
                     GetBranches();
                 }
             }
         }
         catch (Exception ex)
         {
             ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: " + ex.Message + "');", true);
         }
     }
 }
 public void GetVehicle()
 {
     try
     {
         var pResult = "";
         var ds      = _wsCalled.GetAllVechile(Session["connectionString"].ToString(), ref pResult);
         if (pResult == "")
         {
             Session["DsVehicle"]       = ds;
             ASPxGridLookup2.DataSource = ds;
             ASPxGridLookup2.DataBind();
         }
         else
         {
             ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('" + pResult + "');", true);
         }
     }
     catch (Exception ex)
     {
         ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: " + ex.Message + "');", true);
     }
 }
 public void GetRoute()
 {
     try
     {
         var pResult = "";
         var ds      = _objRoute.GetRoute(Session["connectionString"].ToString(), ref pResult);
         if (pResult == "")
         {
             ASPxGridLookup2.DataSource = ds;
             ASPxGridLookup2.DataBind();
             Session["dsRouteBranch"] = ds;
         }
         else
         {
             ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('" + pResult + "');", true);
         }
     }
     catch (Exception ex)
     {
         ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: " + ex.Message + "');", true);
     }
 }
 public void GetWarehouse()
 {
     try
     {
         var objWarehouse = new WSWarehouse.SwiftExpressWSWarehouse();
         var pResult      = "";
         var ds           = objWarehouse.GetWarehouse(Session["connectionString"].ToString(), ref pResult);
         if (pResult == "")
         {
             ASPxGridLookup2.DataSource = ds;
             ASPxGridLookup2.DataBind();
             Session["WAREHOUSE"] = ds;
         }
         else
         {
             ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('" + pResult + "');", true);
         }
         objWarehouse.Dispose();
     }
     catch (Exception ex)
     {
         ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: " + ex.Message + "');", true);
     }
 }
 public void CargarOperador()
 {
     try
     {
         var pResult = "";
         var ds      = _objUsers.GetUsers(Session["connectionString"].ToString(), ref pResult);
         if (pResult == "")
         {
             if (ds.Tables[0].Rows.Count > 0)
             {
                 ASPxGridLookup2.DataSource = ds;
                 ASPxGridLookup2.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 Page_Load(object sender, EventArgs e)
        {
            if (!ValidarConexionYUsuarioLogueado(sender))
            {
                return;
            }
            if (!IsPostBack)
            {
                Session["SAP_PICKING_DATA"] = null;
            }

            if (Session["SAP_PICKING_DATA"] != null)
            {
                ASPxGridView2.DataSource = Session["SAP_PICKING_DATA"];
                ASPxGridView2.DataBind();
            }
            ASPxGridLookup1.GridView.Width = 200;
            ASPxGridLookup3.GridView.Width = 250;
            ASPxGridLookup2.GridView.Width = 200;
            if (Request["__EVENTARGUMENT"] == "KeyPressSpE")
            {
                try
                {
                    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["dsPicking"] = dsDetail;
                        }
                        else
                        {
                            ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('" + pResult + "');", true);
                        }
                        ASPxSpinEdit1.Number = 0;
                        ASPxGridLookup3.Text = "";
                    }

                    else if ((string)Session["INGRESO_HEADER_PICKING"] == "TRUE")
                    {
                        _result = _wscalled.InsertPickingetail((int)Session["Header_picking"], Convert.ToString(ASPxGridLookup3.Value), Convert.ToDecimal(ASPxSpinEdit1.Number), Session["connectionString"].ToString(), ASPxGridLookup3.Text);
                        var pResult  = "";
                        var dsDetail = _wscalled.GetPickingDetailForPickingHeader((int)Session["Header_picking"], Session["connectionString"].ToString(), ref pResult);
                        if (pResult == "")
                        {
                            ASPxGridView1.DataSource = dsDetail;
                            ASPxGridView1.DataBind();
                            Session["dsPicking"] = dsDetail;
                        }
                        else
                        {
                            ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('" + pResult + "');", true);
                        }
                        ASPxSpinEdit1.Number = 0;
                        ASPxGridLookup3.Text = "";
                    }
                    else
                    {
                        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["dsPicking"] = dsDetail;
                            }
                            else
                            {
                                ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('" + pResult + "');", true);
                            }
                            ASPxSpinEdit1.Number = 0;
                            ASPxGridLookup3.Text = "";
                        }
                        else
                        {
                            _result = _wscalled.InsertPickingTemp(Convert.ToString(ASPxComboBox1.Value), Convert.ToString(ASPxGridLookup1.Value), Convert.ToString(ASPxGridLookup2.Text), ASPxSpinEdit2.Text, ASPxSpinEdit3.Text, Session["USER"].ToString(), Session["connectionString"].ToString(), ASPxDateEdit1.Date, Convert.ToInt32(ASPxComboBox2.Value));
                            Session["INGRESO_HEADER_PICKING"] = "TRUE";
                            var pResult  = "";
                            var dsNumber = _wscalled.GetNumberHeaderPicking(Session["connectionString"].ToString(), ref pResult);
                            if (pResult == "")
                            {
                                Session["Header_picking"] =
                                    Convert.ToInt32(dsNumber.Tables[0].Rows[0]["PICKING_HEADER"]);
                                _wscalled.InsertPickingetail(
                                    Convert.ToInt32(dsNumber.Tables[0].Rows[0]["PICKING_HEADER"]),
                                    Convert.ToString(ASPxGridLookup3.Value), Convert.ToDecimal(ASPxSpinEdit1.Number),
                                    Session["connectionString"].ToString(), ASPxGridLookup3.Text);
                                var pResult2 = "";
                                var dsDetail =
                                    _wscalled.GetPickingDetailForPickingHeader((int)Session["Header_picking"],
                                                                               Session["connectionString"].ToString(), ref pResult2);
                                if (pResult2 == "")
                                {
                                    ASPxGridView1.DataSource = dsDetail;
                                    ASPxGridView1.DataBind();
                                    Session["dsPicking"] = dsDetail;
                                }
                                else
                                {
                                    ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('" + pResult2 + "');", true);
                                }
                                ASPxSpinEdit1.Number = 0;
                                ASPxGridLookup3.Text = "";
                            }
                            else
                            {
                                ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('" + pResult + "');", true);
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: " + ex.Message + "');", true);
                }
            }

            if (!Page.IsPostBack)
            {
                try
                {
                    Session["LIST_DOC_ERP_PICKING"] = null;
                    Session["UiListaBodega"]        = null;
                    Session["CODE_WAREHOUSE"]       = "";
                    ASPxDateEdit1.Date = DateTime.Now;
                    Session["INGRESO_HEADER_PICKING"] = "FALSE";
                    GetClassificationPicking();
                    GetAllCostumers();
                    GetOperator();
                    GetSku();
                    Session["SavePicking"] = "false";
                    Session["dsPicking"]   = null;
                    LlenarListaDocErp();
                    LlenarListaBodegas();
                }
                catch (Exception ex)
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: " + ex.Message + "');", true);
                }
            }
            try
            {
                GetSku();
                ASPxGridLookup2.DataSource = Session["OPERATOR"];
                ASPxGridLookup2.DataBind();
                ASPxGridLookup1.DataSource = Session["CUSTOMER"];
                ASPxGridLookup1.DataBind();
                ASPxGridView1.DataSource = Session["dsPicking"];
                ASPxGridView1.DataBind();


                if (Session["LIST_DOC_ERP_PICKING"] != null)
                {
                    UiListaPedidosErp.DataSource = Session["LIST_DOC_ERP_PICKING"];
                    UiListaPedidosErp.DataBind();
                }

                if (!string.IsNullOrEmpty(Session["CODE_WAREHOUSE"].ToString()))
                {
                    LlenarListaBodegas();

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

                    UiListaBodega.Value    = Session["CODE_WAREHOUSE"];
                    UiListaBodegaErp.Value = Session["CODE_WAREHOUSE"];

                    UiListaBodega.Enabled    = false;
                    UiListaBodegaErp.Enabled = false;
                }
                else
                {
                    LlenarListaBodegas();
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: " + ex.Message + "');", true);
            }

            ReportView();
        }