public frmAlquiler() { InitializeComponent(); _ctrlAlquiler = new LogicaNegocio.AlquilerController(); _alquiler = new EntidadNegocio.Entidades.Alquiler(); this.lblFechaDesdeFormato.Visible = false; this.lblFechaHastaFormato.Visible = false; }
private void mstpItemGuardar_Click(object sender, EventArgs e) { try { _alquiler.ID = Convert.ToInt32(txtCodigo.Text.ToString()); _alquiler.IDCliente = Convert.ToInt32(this.cmbCliente.SelectedValue.ToString()); _alquiler.IDProducto = Convert.ToInt32(this.cmbProducto.SelectedValue.ToString()); _alquiler.FechaDesde = DateTime.Parse(txtDesde.Text.ToString()); _alquiler.FechaHasta = DateTime.Parse(txtHasta.Text.ToString()); if (cmbEstatus.SelectedValue.ToString() == "0") { _alquiler.Estatus = EntidadNegocio.Enumerados.EnumTipos.TipoAccionAlquiler.Generado; } else if (cmbEstatus.SelectedValue.ToString() == "1") { _alquiler.Estatus = EntidadNegocio.Enumerados.EnumTipos.TipoAccionAlquiler.Procesado; } else { _alquiler.Estatus = EntidadNegocio.Enumerados.EnumTipos.TipoAccionAlquiler.Pagado; } List <EntidadNegocio.Entidades.Alquiler> _listA = new List <EntidadNegocio.Entidades.Alquiler>(); _listA.Add(_alquiler); if (_ctrlAlquiler.Guardar(_listA)) { MessageBox.Show(EntidadNegocio.Entidades.Mensajes.Info_Guardado, EntidadNegocio.Entidades.Mensajes.Titulo_Guardar, MessageBoxButtons.OK, MessageBoxIcon.Information); this.LimpiarCampos(); this.ControlBotonesMenu(EntidadNegocio.Enumerados.EnumTipos.AccionMenu.Guardar); if (Guardar != null) { Guardar(_alquiler); } ; this.LimpiarCampos(); _ctrlAlquiler = new LogicaNegocio.AlquilerController(); _alquiler = new EntidadNegocio.Entidades.Alquiler(); } } catch (Exception ex) { MessageBox.Show(ex.Message, EntidadNegocio.Entidades.Mensajes.Titulo_Error, MessageBoxButtons.OK, MessageBoxIcon.Error); } }