예제 #1
0
        private void BorrarBodegasFiltrados(object sender, int idCentroDeDistribucion)
        {
            try
            {
                var filasFiltradas = UiGridBodegasDeCentroDeDistribucion.VisibleRowCount;

                var fila = "";

                CentroDeDistribucionArgumento centroDeDistribucionArgumento;
                for (int i = 0; i < filasFiltradas; i++)
                {
                    fila = UiGridBodegasDeCentroDeDistribucion.GetRowValues(i, "CODE_WAREHOUSE").ToString();
                    centroDeDistribucionArgumento = new CentroDeDistribucionArgumento
                    {
                        CentroDeDistribucion = new CentroDeDistribucion
                        {
                            DISTRIBUTION_CENTER_ID = idCentroDeDistribucion
                        }
                        ,
                        Bodega = new Bodega
                        {
                            CODE_WAREHOUSE = fila
                        }
                    };

                    UsuarioDeseaBorrarBodegaACentroDeDistribucion?.Invoke(sender, centroDeDistribucionArgumento);
                }

                UsuarioDeseaObtenerBodegasNoAsociadasACentroDeDistribucion?.Invoke(sender, null);
                UsuarioDeseaObtenerBodegasAsociadasACentroDeDistribucion?.Invoke(sender, new CentroDeDistribucionArgumento
                {
                    CentroDeDistribucion = new CentroDeDistribucion
                    {
                        DISTRIBUTION_CENTER_ID = idCentroDeDistribucion
                    }
                });

                UiVistaCentrosDeDistribucion.JSProperties.Add("cpTerminoDeCargarCentros", "cpTerminoDeCargarCentros");
            }
            catch (Exception ex)
            {
                UiGridBodegasDeCentroDeDistribucion.JSProperties.Add("cpError", ex.Message);
            }
        }
예제 #2
0
        protected void UiGridBodegasDeCentroDeDistribucion_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e)
        {
            e.Cancel = true;
            try
            {
                var WHId = e.Values["CODE_WAREHOUSE"];

                var distributionCenterId = UiVistaCentrosDeDistribucion.GetRowValues(UiVistaCentrosDeDistribucion.FocusedRowIndex, "DISTRIBUTION_CENTER_ID").ToString();

                CentroDeDistribucionArgumento centroDeDistribucionArgumento = new CentroDeDistribucionArgumento
                {
                    CentroDeDistribucion = new CentroDeDistribucion
                    {
                        DISTRIBUTION_CENTER_ID = int.Parse(distributionCenterId)
                    }
                    ,
                    Bodega = new Bodega
                    {
                        CODE_WAREHOUSE = (string)WHId
                    }
                };

                UsuarioDeseaBorrarBodegaACentroDeDistribucion?.Invoke(sender, centroDeDistribucionArgumento);

                UsuarioDeseaObtenerBodegasNoAsociadasACentroDeDistribucion?.Invoke(sender, null);
                UsuarioDeseaObtenerBodegasAsociadasACentroDeDistribucion?.Invoke(sender, new CentroDeDistribucionArgumento
                {
                    CentroDeDistribucion = new CentroDeDistribucion
                    {
                        DISTRIBUTION_CENTER_ID = int.Parse(distributionCenterId)
                    }
                });

                UiGridBodegasDeCentroDeDistribucion.JSProperties.Add("cpTerminoDeCargarCentros", "cpTerminoDeCargarCentros");
            }
            catch (Exception ex)
            {
                EstablecerError("No se ha podido eliminar el Cliente seleccionado debido a: " + ex.Message, sender);
            }
        }
예제 #3
0
        protected void UiVistaCentrosDeDistribucion_CustomCallBack(object sender, ASPxGridViewCustomCallbackEventArgs e)
        {
            var idCentroDeDistribucion     = 0;
            var nombreCentroDeDistribucion = "";

            switch (e.Parameters.Split('|')[0])
            {
            case "ObtenerCentrosDeDistribucion":
                UsuarioDeseaObtenerCentroDeDistribucion?.Invoke(sender, new CentroDeDistribucionArgumento {
                    CentroDeDistribucion = new CentroDeDistribucion {
                        DISTRIBUTION_CENTER_ID = null
                    }
                });
                break;

            case "GrabarCentroDeDistribucion":
                GrabarCentroDeDistribucion(sender, int.Parse(e.Parameters.Split('|')[1]));
                break;

            case "EliminarCentroDeDistribucion":
                EliminarCentroDeDistribucion(sender);
                break;

            case "ObtenerInformacionDeCentroDeDistribucionSeleccionado":
                idCentroDeDistribucion = int.Parse(e.Parameters.Split('|')[1]);
                var listaCentrosDeDistribucion = (IList <CentroDeDistribucion>)Session["UiVistaCentrosDeDistribucion"];
                foreach (CentroDeDistribucion item in listaCentrosDeDistribucion.Where(item => item.DISTRIBUTION_CENTER_ID == idCentroDeDistribucion))
                {
                    UiVistaCentrosDeDistribucion.JSProperties.Add("cpProcesarDatosDeCentroDeDistribucion", item);
                }

                UsuarioDeseaObtenerBodegasNoAsociadasACentroDeDistribucion?.Invoke(sender, null);
                UsuarioDeseaObtenerBodegasAsociadasACentroDeDistribucion?.Invoke(sender, new CentroDeDistribucionArgumento
                {
                    CentroDeDistribucion = new CentroDeDistribucion
                    {
                        DISTRIBUTION_CENTER_ID = idCentroDeDistribucion
                    }
                });

                UiVistaCentrosDeDistribucion.JSProperties.Add("cpTerminoDeCargarCentros", "cpTerminoDeCargarCentros");

                break;

            case "AsignarBodegasACentroDeDistribucion":
                AsignarBodegasACentroDeDistribucion(sender);

                break;

            case "BorrarTodasLasBodegasAsociadas":
                var lstBodegaBorrar      = new List <Bodega>();
                var distributionCenterId = UiVistaCentrosDeDistribucion.GetRowValues(UiVistaCentrosDeDistribucion.FocusedRowIndex, "DISTRIBUTION_CENTER_ID").ToString();
                for (int i = 0; i < UiGridBodegasDeCentroDeDistribucion.VisibleRowCount; i++)
                {
                    CentroDeDistribucionArgumento centroDeDistribucionArgumento = new CentroDeDistribucionArgumento
                    {
                        CentroDeDistribucion = new CentroDeDistribucion
                        {
                            DISTRIBUTION_CENTER_ID = int.Parse(distributionCenterId)
                        }
                        ,
                        Bodega = new Bodega
                        {
                            CODE_WAREHOUSE = ((Bodega)UiGridBodegasDeCentroDeDistribucion.GetRow(i)).CODE_WAREHOUSE
                        }
                    };
                    UsuarioDeseaBorrarBodegaACentroDeDistribucion?.Invoke(sender, centroDeDistribucionArgumento);
                }

                UsuarioDeseaObtenerBodegasNoAsociadasACentroDeDistribucion?.Invoke(sender, null);
                UsuarioDeseaObtenerBodegasAsociadasACentroDeDistribucion?.Invoke(sender, new CentroDeDistribucionArgumento
                {
                    CentroDeDistribucion = new CentroDeDistribucion
                    {
                        DISTRIBUTION_CENTER_ID = int.Parse(distributionCenterId)
                    }
                });

                UiVistaCentrosDeDistribucion.JSProperties.Add("cpTerminoDeCargarCentros", "cpTerminoDeCargarCentros");
                break;
            }
        }