protected void Page_Load(object sender, EventArgs e) { if (Session["connectionString"] == null || Session["USER"] == null) { ScriptManager.RegisterStartupScript(this, GetType(), "Logoff", "LogOff();", true); return; } if (Session["UiVistaCentrosDeDistribucion"] != null) { UiVistaCentrosDeDistribucion.DataSource = Session["UiVistaCentrosDeDistribucion"]; UiVistaCentrosDeDistribucion.DataBind(); } if (Session["UiListaBodegasCentroDeDistribucion"] != null) { UiListaBodegasCentroDeDistribucion.DataSource = null; UiListaBodegasCentroDeDistribucion.DataBind(); UiListaBodegasCentroDeDistribucion.DataSource = Session["UiListaBodegasCentroDeDistribucion"]; UiListaBodegasCentroDeDistribucion.DataBind(); } if (Session["UiGridBodegasDeCentroDeDistribucion"] != null) { UiGridBodegasDeCentroDeDistribucion.DataSource = null; UiGridBodegasDeCentroDeDistribucion.DataBind(); UiGridBodegasDeCentroDeDistribucion.DataSource = Session["UiGridBodegasDeCentroDeDistribucion"]; UiGridBodegasDeCentroDeDistribucion.DataBind(); } VistaTerminoDeCargar?.Invoke(this, null); }
private void GrabarCentroDeDistribucion(object sender, int filaSeleccionada) { try { var actualizacion = true; var logoAntiguo = ""; if (UiTxtNumeroCentroDeDistribucion.Value == null) { actualizacion = false; } if (actualizacion) { logoAntiguo = UiVistaCentrosDeDistribucion.GetRowValues(filaSeleccionada, "LOGO_IMG").ToString(); } var centroDeDistribucion = new CentroDeDistribucion(); centroDeDistribucion.DISTRIBUTION_CENTER_ID = UiTxtNumeroCentroDeDistribucion.Value == null ? 0 : int.Parse(UiTxtNumeroCentroDeDistribucion.Value.ToString()); centroDeDistribucion.NAME_DISTRIBUTION_CENTER = UiTxtNombreCentroDeDistribucion.Value.ToString(); centroDeDistribucion.DESCRIPTION_DISTRIBUTION_CENTER = UiTxtDescripcionCentroDeDistribucion.Value.ToString(); centroDeDistribucion.ADRESS_DISTRIBUTION_CENTER = UiTxtDireccionCentroDeDistribucion.Value.ToString(); centroDeDistribucion.LATITUDE = UiSpinLatitudCentroDeDistribucion.Value.ToString(); centroDeDistribucion.LONGITUDE = UiSpinLongitudCentroDeDistribucion.Value.ToString(); if (Session["UiLogoCentroDeDistribucion"] == null) { centroDeDistribucion.LOGO_IMG = logoAntiguo; } else { centroDeDistribucion.LOGO_IMG = Session["UiLogoCentroDeDistribucion"].ToString(); } var centroDeDistribucionArg = new CentroDeDistribucionArgumento(); centroDeDistribucionArg.CentroDeDistribucion = centroDeDistribucion; centroDeDistribucionArg.LOGIN = Session["USER"].ToString(); if (actualizacion) { UsuarioDeseaActualizarCentroDeDistribucion?.Invoke(sender, centroDeDistribucionArg); LimpiarCampos(); } else { UsuarioDeseaAgregarCentroDeDistribucion?.Invoke(sender, centroDeDistribucionArg); LimpiarCampos(); } } catch (Exception ex) { EstablecerError(ex.Message, UiVistaCentrosDeDistribucion); } }
private void AsignarBodegasACentroDeDistribucion(object sender) { int idCD = int.Parse(UiVistaCentrosDeDistribucion.GetRowValues(UiVistaCentrosDeDistribucion.FocusedRowIndex, "DISTRIBUTION_CENTER_ID").ToString()); var listaBodegasAAsociar = UiListaBodegasCentroDeDistribucion.GridView.GetSelectedFieldValues("CODE_WAREHOUSE", "DESCRIPTION_WAREHOUSE"); if (listaBodegasAAsociar.Count > 0) { List <Bodega> listaBodegas = new List <Bodega>(); foreach (var bodega in listaBodegasAAsociar) { CentroDeDistribucionArgumento bodegaAsignacion = new CentroDeDistribucionArgumento { CentroDeDistribucion = new CentroDeDistribucion { DISTRIBUTION_CENTER_ID = idCD } , Bodega = new Bodega { CODE_WAREHOUSE = ((object[])bodega)[0].ToString() } }; UsuarioDeseaAgregarBodegaACentroDeDistribucion?.Invoke(sender, bodegaAsignacion); bodegaAsignacion = null; } UsuarioDeseaObtenerBodegasNoAsociadasACentroDeDistribucion?.Invoke(sender, null); UsuarioDeseaObtenerBodegasAsociadasACentroDeDistribucion?.Invoke(sender, new CentroDeDistribucionArgumento { CentroDeDistribucion = new CentroDeDistribucion { DISTRIBUTION_CENTER_ID = idCD } }); UsuarioDeseaObtenerBodegasNoAsociadasACentroDeDistribucion?.Invoke(sender, null); UsuarioDeseaObtenerBodegasAsociadasACentroDeDistribucion?.Invoke(sender, new CentroDeDistribucionArgumento { CentroDeDistribucion = new CentroDeDistribucion { DISTRIBUTION_CENTER_ID = idCD } }); UiVistaCentrosDeDistribucion.JSProperties.Add("cpTerminoDeCargarCentros", "cpTerminoDeCargarCentros"); } }
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); } }
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; } }