protected void btnSave_Click(object sender, EventArgs e) { try { var dao = BusinessMapper.GetDaoByEntity(BusinessMapper.eEntities.IdentAtencion); IdentAtencionDTO entity = (DTO.IdentAtencionDTO)CRUDHelper.Read(Convert.ToInt32(pnlControls.Attributes["RecId"]), dao); FormsHelper.FillEntity(tblControls, entity); if (!entity.Estado && dao.ExisteAvisoEnVigencia(entity.IdentifIdentAte)) { throw new Exception("No se puede deshabilitar, ya que se encuentra en uso por un aviso vigente."); } CRUDHelper.Update(entity, BusinessMapper.GetDaoByEntity(BusinessMapper.eEntities.IdentAtencion)); pnlControls.Visible = false; RefreshGrid(gv); } catch (Exception ex) { FormsHelper.MsgError(lblError, ex); } }
protected void Page_Load(object sender, EventArgs e) { DAO = BusinessMapper.GetDaoByEntity(BusinessMapper.eEntities.PiezasArte); if (!Page.IsPostBack && !Page.IsCallback) { trMsg.Visible = false; trAbm.Visible = false; gvABM.SettingsBehavior.AllowSelectByRowClick = true; gvABM.SettingsBehavior.AllowSelectSingleRowOnly = true; FormsHelper.BuildColumnsByEntity(BusinessMapper.eEntities.PiezasArte, gv); FormsHelper.InicializarPropsGrilla(gv); } ucIdentifAnun.Inicializar(BusinessMapper.eEntities.AnunInternos); ucIdentifTipoPieza.Inicializar(BusinessMapper.eEntities.TipoPieza); ucIdentifSKU.Inicializar(BusinessMapper.eEntities.SKU); ucIdentifTipoPieza.ComboBox.AutoPostBack = true; ucIdentifTipoPieza.ComboBox.SelectedIndexChanged += new EventHandler(TipoPieza_SelectedIndexChanged); gvABM.KeyFieldName = "RecId"; ASPxMenu1.ItemClick += new DevExpress.Web.ASPxMenu.MenuItemEventHandler(ASPxMenu1_ItemClick); rbTipoProd.AutoPostBack = true; rbTipoProd.SelectedIndexChanged += new EventHandler(rbTipoProd_SelectedIndexChanged); RefreshGrid(gv); RefreshAbmGrid(gvABM); lblError.Text = string.Empty; lblErrorProducto.Text = string.Empty; }
void gvABM_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e) { e.Cancel = true; CRUDHelper.Delete(Convert.ToInt32(e.Keys[0]), BusinessMapper.GetDaoByEntity(BusinessMapper.eEntities.FrecuenciaDet)); RefreshAbmGrid(gvABM); }
protected void cbIdentifIdentAte_ItemsRequestedByFilterCondition(object source, DevExpress.Web.ASPxEditors.ListEditItemsRequestedByFilterConditionEventArgs e) { ASPxComboBox comboBox = (ASPxComboBox)source; var daoIdentAtencion = BusinessMapper.GetDaoByEntity(BusinessMapper.eEntities.IdentAtencion); comboBox.DataSource = daoIdentAtencion.FindPaginado(e.Filter, (e.BeginIndex + 1), (e.EndIndex + 1)); comboBox.DataBind(); }
protected void cbIdentifIdentAte_ItemRequestedByValue(object source, DevExpress.Web.ASPxEditors.ListEditItemRequestedByValueEventArgs e) { if (e.Value == null || Convert.ToString(e.Value) == string.Empty) { return; } ASPxComboBox comboBox = (ASPxComboBox)source; var daoIdentAtencion = BusinessMapper.GetDaoByEntity(BusinessMapper.eEntities.IdentAtencion); comboBox.DataSource = daoIdentAtencion.FindValue(Convert.ToString(e.Value)); comboBox.DataBind(); }
public void Inicializar(BusinessMapper.eEntities entidad) { ObjetoDTO = DTOHelper.InstanciarObjetoPorNombreDeTabla(entidad.ToString()); Entidad = entidad; dao = BusinessMapper.GetDaoByEntity(entidad); this.create = Create; this.update = Update; this.ReadMethod = Read; this.delete = Delete; List <ABMControl> controls = GetControlsByEntity(entidad); BuildControls(controls.ToArray()); }
protected void Page_Load(object sender, EventArgs e) { DAO = BusinessMapper.GetDaoByEntity(BusinessMapper.eEntities.Avisos); lblError.Text = string.Empty; lblErrorProducto.Text = string.Empty; if (!Page.IsPostBack && !Page.IsCallback) { trMsg.Visible = false; trAbm.Visible = false; gvABM.SettingsBehavior.AllowSelectByRowClick = true; gvABM.SettingsBehavior.AllowSelectSingleRowOnly = true; FormsHelper.BuildColumnsByEntity(BusinessMapper.eEntities.Avisos, gv); FormsHelper.InicializarPropsGrilla(gv); cbIdentifIdentAte.CallbackPageSize = 10; cbIdentifIdentAte.EnableCallbackMode = true; cbIdentifIdentAte.IncrementalFilteringMode = DevExpress.Web.ASPxEditors.IncrementalFilteringMode.Contains; cbIdentifIdentAte.ValueField = "IdentifIdentAte"; cbIdentifIdentAte.Columns.Add("IdentifIdentAte", "Codigo"); cbIdentifIdentAte.Columns.Add("Name", "Nombre"); cbIdentifIdentAte.Columns.Add("Asignado", "Asignado"); } ucIdentifEspacio.Inicializar(BusinessMapper.eEntities.EspacioCont); ucIdentifFormAviso.Inicializar(BusinessMapper.eEntities.FormAviso); ucIdentifPieza.Inicializar(BusinessMapper.eEntities.PiezasArte); ucIdentifPieza.ComboBox.AutoPostBack = true; ucIdentifPieza.ComboBox.SelectedIndexChanged += new EventHandler(Pieza_SelectedIndexChanged); gvABM.KeyFieldName = "RecId"; ASPxMenu1.ItemClick += new DevExpress.Web.ASPxMenu.MenuItemEventHandler(ASPxMenu1_ItemClick); btnAdd.Click += new EventHandler(btnAdd_Click); btnCancel.Click += new EventHandler(btnCancel_Click); btnDelete.Click += new EventHandler(btnDelete_Click); btnSave.Click += new EventHandler(btnSave_Click); btnAddAtencion.Click += new EventHandler(btnAddAtencion_Click); btnDeleteAtencion.Click += new EventHandler(btnDeleteAtencion_Click); RefreshGrid(gv); RefreshAbmGrid(gvABM); }
protected void btnAdd_Click(object sender, EventArgs e) { try { var entity = new DTO.IdentAtencionDTO(); FormsHelper.FillEntity(tblControls, entity); CRUDHelper.Create(entity, BusinessMapper.GetDaoByEntity(BusinessMapper.eEntities.IdentAtencion)); pnlControls.Visible = false; RefreshGrid(gv); } catch (Exception ex) { FormsHelper.MsgError(lblError, ex); } }
void Pieza_SelectedIndexChanged(object sender, EventArgs e) { DTO.PiezasArteDTO pieza = CRUDHelper.Read( string.Format("IdentifPieza = '{0}'", ucIdentifPieza.SelectedValue), BusinessMapper.GetDaoByEntity(BusinessMapper.eEntities.PiezasArte)); if ((pieza != null && pieza.Duracion.HasValue && pieza.Duracion > 0)) { trDuracion.Visible = true; spDuracion.Value = pieza.Duracion; } else { trDuracion.Visible = false; spDuracion.Value = null; } }
protected void btnDelete_Click(object sender, EventArgs e) { try { if (pnlControls.Attributes["RecId"] != null) { CRUDHelper.Delete(Convert.ToInt32(pnlControls.Attributes["RecId"]), BusinessMapper.GetDaoByEntity(BusinessMapper.eEntities.IdentAtencion)); pnlControls.Visible = false; RefreshGrid(gv); } } catch (Exception ex) { FormsHelper.MsgError(lblError, ex); } }
protected void btnSave_Click(object sender, EventArgs e) { string err = string.Empty; try { if (Valid(out err)) { var entity = CRUDHelper.Read(Convert.ToInt32(pnlControls.Attributes["RecId"]), BusinessMapper.GetDaoByEntity(BusinessMapper.eEntities.EspacioCont)); FormsHelper.FillEntity(tblControls, entity); if (!trIntervalo.Visible) { entity.IdentifIntervalo = null; } if (!trFrecuencia.Visible) { entity.IdentifFrecuencia = null; } if (!trHoraFin.Visible || !trHoraInicio.Visible) { entity.HoraFin = null; entity.HoraInicio = null; } CRUDHelper.Update(entity, BusinessMapper.GetDaoByEntity(BusinessMapper.eEntities.EspacioCont)); pnlControls.Visible = false; RefreshGrid(gv); } else { throw new Exception(err); } } catch (Exception ex) { FormsHelper.MsgError(lblError, ex); } }
protected void ASPxMenu1_ItemClick(object source, MenuItemEventArgs e) { switch (e.Item.Name) { case "btnAdd": FormsHelper.ClearControls(tblControls, new DTO.IdentAtencionDTO()); FormsHelper.ShowOrHideButtons(tblControls, FormsHelper.eAccionABM.Add); pnlControls.Visible = true; pnlControls.HeaderText = "Agregar Registro"; break; case "btnEdit": if (FormsHelper.GetSelectedId(gv) != null) { FormsHelper.ClearControls(tblControls, new DTO.IdentAtencionDTO()); var entity = CRUDHelper.Read(FormsHelper.GetSelectedId(gv).Value, BusinessMapper.GetDaoByEntity(BusinessMapper.eEntities.IdentAtencion)); FormsHelper.FillControls(entity, tblControls); FormsHelper.ShowOrHideButtons(tblControls, FormsHelper.eAccionABM.Edit); pnlControls.Attributes.Add("RecId", entity.RecId.ToString()); pnlControls.Visible = true; pnlControls.HeaderText = "Modificar Registro"; TipIdentifChanged(); } else { pnlControls.Visible = false; } break; case "btnDelete": if (FormsHelper.GetSelectedId(gv) != null) { FormsHelper.ShowOrHideButtons(tblControls, FormsHelper.eAccionABM.Delete); pnlControls.Attributes.Add("RecId", FormsHelper.GetSelectedId(gv).ToString()); pnlControls.Visible = true; pnlControls.HeaderText = "Eliminar Registros"; } else { pnlControls.Visible = false; } break; case "btnExport": case "btnExportXls": if (ASPxGridViewExporter1 != null) { ASPxGridViewExporter1.WriteXlsToResponse(); } break; case "btnExportPdf": if (ASPxGridViewExporter1 != null) { ASPxGridViewExporter1.WritePdfToResponse(); } break; default: break; } }
private void RefreshGrid(ASPxGridView gv) { gv.DataSource = CRUDHelper.ReadAll("", BusinessMapper.GetDaoByEntity(BusinessMapper.eEntities.IdentAtencion)); gv.DataBind(); }
void TipoPieza_SelectedIndexChanged(object sender, EventArgs e) { DTO.TipoPiezaDTO tipoPieza = CRUDHelper.Read(string.Format("IdentifTipoPieza = '{0}'", ucIdentifTipoPieza.SelectedValue), BusinessMapper.GetDaoByEntity(BusinessMapper.eEntities.TipoPieza)); trDuracion.Visible = (tipoPieza != null && tipoPieza.Duracion); }
protected void Page_Load(object sender, EventArgs e) { //Invisibilizo los controles btnRefresh y btnAdd del ucIdentifEspacio0 UcIdentifEspacio0.Controls[0].Controls[0].Controls[3].Visible = false; UcIdentifEspacio0.Controls[0].Controls[0].Controls[5].Visible = false; // DAO = BusinessMapper.GetDaoByEntity(BusinessMapper.eEntities.Costos); lblError.Text = string.Empty; lblErrorProveedor.Text = string.Empty; lblErrorFrecuencia.Text = string.Empty; if (!Page.IsPostBack && !Page.IsCallback) { trMsg.Visible = false; trAbm.Visible = false; //Inicializo los controles del ABM trTipoHorario.Visible = false; trFrecuencia.Visible = false; trDia.Visible = false; trDiaSemana.Visible = false; trHoraDesde.Visible = false; trHoraHasta.Visible = false; //Inicializo las 3 grillas. FormsHelper.BuildColumnsByEntity(BusinessMapper.eEntities.Costos, gv); FormsHelper.BuildColumnsByEntity(BusinessMapper.eEntities.Costos, gvVersiones); gvABMFrecuencia.Columns.Add(new GridViewDataColumn("Dia", "Día")); gvABMFrecuencia.Columns.Add(new GridViewDataComboBoxColumn() { Caption = "Día Semana", FieldName = "DiaSemana" }); gvABMFrecuencia.Columns.Add(new GridViewDataTimeEditColumn() { Caption = "Hora Desde", FieldName = "HoraDesde" }); gvABMFrecuencia.Columns.Add(new GridViewDataTimeEditColumn() { Caption = "Hora Hasta", FieldName = "HoraHasta" }); gvABMFrecuencia.Columns.Add(new GridViewDataColumn("Costo", "Costo")); FormsHelper.FillDias((gvABMFrecuencia.Columns["DiaSemana"] as GridViewDataComboBoxColumn).PropertiesComboBox.Items); gvABMProveedor.Columns.Add(FormsHelper.BuildComboColumn("Proveedor", "IdentifProv", BusinessMapper.eEntities.Proveedor)); gvABMProveedor.Columns.Add(FormsHelper.BuildComboColumn("Categoría de Costo", "Categoria", "Directo", "DIRECTO", "Indirecto", "INDIRECTO")); gvABMProveedor.Columns.Add(new GridViewDataCheckColumn() { Caption = "Incluido en Orden Publicidad", FieldName = "IncluidoOP" }); gvABMProveedor.Columns.Add(new GridViewDataCheckColumn() { Caption = "Estimado", FieldName = "Estimado" }); gvABMProveedor.Columns.Add(FormsHelper.BuildComboColumn("Tipo de Costo", "TipoCosto", "Fijo Mensual", "FIJO_MENSUAL", "Segundo Fijo", "SEGUNDO_FIJO", "Unidad Pautada", "UNIDAD_PAUTADA")); gvABMProveedor.Columns.Add(FormsHelper.BuildComboColumn("Moneda", "IdentifMon", BusinessMapper.eEntities.Monedas)); gvABMProveedor.Columns.Add(new GridViewDataColumn("GrossingUp", "Grossing Up")); gvABMProveedor.Columns.Add(new GridViewDataColumn("Costo", "Costo")); FormsHelper.InicializarPropsGrilla(gv); FormsHelper.InicializarPropsGrilla(gvABMFrecuencia); FormsHelper.InicializarPropsGrilla(gvABMProveedor); FormsHelper.InicializarPropsGrilla(gvVersiones); gvABMFrecuencia.Settings.ShowGroupPanel = false; gvABMProveedor.Settings.ShowGroupPanel = false; gvVersiones.Settings.ShowGroupPanel = false; } ucIdentifEspacio.Inicializar(BusinessMapper.eEntities.EspacioCont); UcIdentifEspacio0.Inicializar(BusinessMapper.eEntities.EspacioCont); UcIdentifEspacio0.ComboBox.AutoPostBack = true; UcIdentifEspacio0.ComboBox.SelectedIndexChanged += new EventHandler(IdentifEspacio0_SelectedIndexChanged); ucIdentifFrecuencia.Inicializar(BusinessMapper.eEntities.Frecuencia); ucIdentifMon.Inicializar(BusinessMapper.eEntities.Monedas); ucIdentifProv.Inicializar(BusinessMapper.eEntities.Proveedor); ucIdentifEspacio.ComboBox.AutoPostBack = true; ucIdentifEspacio.ComboBox.SelectedIndexChanged += new EventHandler(IdentifEspacio_SelectedIndexChanged); ucIdentifFrecuencia.ComboBox.AutoPostBack = true; ucIdentifFrecuencia.ComboBox.SelectedIndexChanged += new EventHandler(IdentifFrecuencia_SelectedIndexChanged); rbFrecuencia.AutoPostBack = true; rbFrecuencia.SelectedIndexChanged += new EventHandler(rbFrecuencia_SelectedIndexChanged); rbHorario.AutoPostBack = true; rbHorario.SelectedIndexChanged += new EventHandler(rbHorario_SelectedIndexChanged); gvABMFrecuencia.KeyFieldName = "RecId"; gvABMProveedor.KeyFieldName = "RecId"; gvVersiones.KeyFieldName = "RecId"; ASPxMenu1.ItemClick += new DevExpress.Web.ASPxMenu.MenuItemEventHandler(ASPxMenu1_ItemClick); RefreshGrid(gv); RefreshAbmGrid(gvABMProveedor); RefreshAbmGrid(gvABMFrecuencia); RefreshGrid(gvVersiones); }
private void ucFrecuenciaChanged() { if (ucIdentifFrecuencia.SelectedValue != null) { DTO.FrecuenciaDTO frecuencia = CRUDHelper.Read(string.Format("IdentifFrecuencia = '{0}'", ucIdentifFrecuencia.SelectedValue), BusinessMapper.GetDaoByEntity(BusinessMapper.eEntities.Frecuencia)); trDia.Visible = (frecuencia.SemMes.Trim().ToUpper() == MES); trDiaSemana.Visible = (frecuencia.SemMes.Trim().ToUpper() == SEMANA); } else { trDia.Visible = false; trDiaSemana.Visible = false; } if (!trDia.Visible) //Si no se muestra, va en NULL. { spDia.Value = null; } if (!trDiaSemana.Visible) //Si no se muestra, va en NULL. { clDiaSemana.SelectedItem = null; } }
private void ucEspacioChanged() { trTipoHorario.Visible = false; rbHorario.SelectedItem = rbHorario.Items.FindByValue(TODO); if (ucIdentifEspacio.SelectedValue != null) { DTO.EspacioContDTO espacio = CRUDHelper.Read(string.Format("IdentifEspacio = '{0}'", ucIdentifEspacio.SelectedValue), BusinessMapper.GetDaoByEntity(BusinessMapper.eEntities.EspacioCont)); trTipoHorario.Visible = (espacio.HoraFin.HasValue && espacio.HoraFin.Value.TotalMinutes > 0); if (!(espacio.HoraFin.HasValue && espacio.HoraFin.Value.TotalMinutes > 0)) { rbHorario.SelectedItem = rbHorario.Items.FindByValue(TODO); } } rbHorarioChanged(); }
private void RefreshGrid(ASPxGridView gv) { gv.DataSource = CRUDHelper.ReadAll("", BusinessMapper.GetDaoByEntity(Entity)); gv.DataBind(); }
private void TipoDeEspacioChanged() { DTO.TipoEspacioDTO espacio = CRUDHelper.Read(string.Format("IdentifTipoEsp='{0}'", ucIdentifTipoEsp.SelectedValue), BusinessMapper.GetDaoByEntity(BusinessMapper.eEntities.TipoEspacio)); trFrecuencia.Visible = espacio.Frecuencia; trHoraInicio.Visible = espacio.Hora; trHoraFin.Visible = espacio.Hora; trIntervalo.Visible = espacio.Intervalo; UpdatePanel1.Update(); }
private bool ValidProducto(out string err) { err = string.Empty; if (ucIdentifSKU.SelectedValue == null) { err = "Debe seleccionar un producto."; return(false); } if (!((DTO.SKUDTO)CRUDHelper.Read(string.Format("IdentifSKU = '{0}'", ucIdentifSKU.SelectedValue), BusinessMapper.GetDaoByEntity(BusinessMapper.eEntities.SKU))).Activo) { err = "El producto no se encuentra Activo."; return(false); } if (rbTipoProd.SelectedItem == null) { err = "Debe seleccionar si el tipo de producto es Primario o Secundario."; return(false); } if (spCoeficiente.Value != null && (spCoeficiente.Number > 1 || spCoeficiente.Number < 0)) { err = "El 'Coeficiente' debe estar entre los valores 0 y 1."; return(false); } return(true); }
protected void btnSave_Click(object sender, EventArgs e) { try { var entity = CRUDHelper.Read(Convert.ToInt32(pnlControls.Attributes["RecId"]), BusinessMapper.GetDaoByEntity(BusinessMapper.eEntities.Frecuencia)); FormsHelper.FillEntity(tblControls, entity); Business.Frecuencias.Update(entity, Detalles); pnlControls.Visible = false; RefreshGrid(gv); } catch (Exception ex) { FormsHelper.MsgError(lblError, ex); } }
protected void ASPxMenu1_ItemClick(object source, MenuItemEventArgs e) { try { switch (e.Item.Name) { case "btnAdd": FormsHelper.ClearControls(tblControls, new DTO.FrecuenciaDTO()); FormsHelper.ShowOrHideButtons(tblControls, FormsHelper.eAccionABM.Add); pnlDias.Visible = false; Detalles = new List <DTO.FrecuenciaDetDTO>(); RefreshAbmGrid(gvABM); pnlControls.Visible = true; pnlControls.HeaderText = "Agregar Registro"; trDias.Visible = true; rbSemMes.Enabled = true; break; case "btnEdit": if (FormsHelper.GetSelectedId(gv) != null) { FormsHelper.ClearControls(tblControls, new DTO.FrecuenciaDTO()); var entity = CRUDHelper.Read(FormsHelper.GetSelectedId(gv).Value, BusinessMapper.GetDaoByEntity(BusinessMapper.eEntities.Frecuencia)); FormsHelper.FillControls(entity, tblControls); FormsHelper.ShowOrHideButtons(tblControls, FormsHelper.eAccionABM.Edit); Detalles = CRUDHelper.ReadAll(string.Format("IdentifFrecuencia = '{0}'", entity.IdentifFrecuencia), BusinessMapper.GetDaoByEntity(BusinessMapper.eEntities.FrecuenciaDet)); rbSemMes.Enabled = (Detalles.Count == 0); rbSemMesChanged(); gvABM.Attributes.Add("IdentifFrecuencia", entity.IdentifFrecuencia); trDias.Visible = true; RefreshAbmGrid(gvABM); pnlControls.Attributes.Add("RecId", entity.RecId.ToString()); pnlControls.Visible = true; pnlControls.HeaderText = "Modificar Registro"; } else { pnlControls.Visible = false; } break; case "btnDelete": rbSemMes.Enabled = (Detalles.Count == 0); if (FormsHelper.GetSelectedId(gv) != null) { FormsHelper.ShowOrHideButtons(tblControls, FormsHelper.eAccionABM.Delete); pnlControls.Attributes.Add("RecId", FormsHelper.GetSelectedId(gv).ToString()); pnlControls.Visible = true; pnlControls.HeaderText = "Eliminar Registros"; } else { pnlControls.Visible = false; } break; case "btnExport": case "btnExportXls": if (ASPxGridViewExporter1 != null) { ASPxGridViewExporter1.GridViewID = "gv"; } ASPxGridViewExporter1.WriteXlsToResponse(); break; case "btnExportPdf": if (ASPxGridViewExporter1 != null) { ASPxGridViewExporter1.GridViewID = "gv"; } ASPxGridViewExporter1.WritePdfToResponse(); break; default: break; } } catch (Exception ex) { FormsHelper.MsgError(lblError, ex); } }
protected void detailGrid_DataSelect(object sender, EventArgs e) { ASPxGridView gvDetail = (ASPxGridView)sender; gvDetail.DataSource = CRUDHelper.ReadAll(string.Format("IdentifFrecuencia = '{0}'", gvDetail.GetMasterRowFieldValues("IdentifFrecuencia")), BusinessMapper.GetDaoByEntity(BusinessMapper.eEntities.FrecuenciaDet)); gvDetail.Columns["IdentifFrecuencia"].Visible = false; string semMes = Convert.ToString(gvDetail.GetMasterRowFieldValues("SemMes")); gvDetail.Columns["DiaSemana"].Visible = (semMes.Trim().ToLower() == "semana"); gvDetail.Columns["Dia"].Visible = (semMes.Trim().ToLower() != "semana"); }