Пример #1
0
        private void CargarPlanificaciones()
        {
            try
            {
                this.lstUiPlanificaciones = new List <Planificacion>();

                var lstBePlanificacion = new BD.Planificacion().Listar();
                foreach (var bePlanificacion in lstBePlanificacion)
                {
                    var uiPlanificacion = new Planificacion();

                    uiPlanificacion.Id   = bePlanificacion.Id;
                    uiPlanificacion.Dia  = General.GetNameOfDay(bePlanificacion.Dia);
                    uiPlanificacion.Hora = bePlanificacion.Hora.TimeOfDay;

                    this.lstUiPlanificaciones.Add(uiPlanificacion);
                }

                this.dgvPlanificaciones.DataSource = this.lstUiPlanificaciones;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #2
0
        private void btnQuitar_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.dgvPlanificaciones.CurrentRow != null)
                {
                    var uiPlanificacion = (Planificacion)this.dgvPlanificaciones.CurrentRow.DataBoundItem;

                    bool rpta = new BD.Planificacion().Eliminar(uiPlanificacion.Id);
                    if (rpta)
                    {
                        this.CargarPlanificaciones();
                    }
                }
            }
            catch (Exception ex)
            {
                General.ErrorMessage(ex.Message);
            }
        }
Пример #3
0
        private void btnAgregar_Click(object sender, EventArgs e)
        {
            try
            {
                var plan = new BE.Planificacion();
                plan.Id   = 0;
                plan.Dia  = this.cboDia.SelectedIndex;
                plan.Hora = this.dtpHora.Value;

                bool rpta = new BD.Planificacion().Insertar(ref plan);
                if (rpta)
                {
                    this.CargarPlanificaciones();
                }
            }
            catch (Exception ex)
            {
                General.ErrorMessage(ex.Message);
            }
        }