private void txtCodigocategoria_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter && txtCodigoCategoria.Text != "") { _Categoria = new CategoriaN(int.Parse(txtCodigoCategoria.Text)); if (_Categoria.Succed) { txtNombreCategoria.Text = _Categoria.Nombre; epControlCampos.Clear(); } } else if (e.KeyCode == Keys.Enter && txtCodigoCategoria.Text == "") { txtNombreCategoria.Text = ""; } else if (e.KeyCode == Keys.F3) { try { List <CategoriaN> Categoria = Negocios.FuncionesGlobales.CategoriaS.ListarCategoria(); string[] cool = { "Id", "Nombre" }; txtCodigoCategoria.Parametros <CategoriaN>(Keys.F3, cool, "Id", Categoria, "Nombre"); } catch (Exception E) { MessageBox.Show(E.StackTrace); throw; } } }
private void btnGrabar_Click(object sender, EventArgs e) { if (_ModoAM == Negocios.FuncionesGlobales.Globales.Modo.Agregar) { _CategoriaN = new CategoriaN(txtNombre.Text); if (_CategoriaN.Guardar()) { if (_CategoriaN.Succed == true) { MessageBox.Show("Se Grabo la Categoria " + txtNombre.Text); } else { MessageBox.Show("No se pudo grabar la Categoria " + txtNombre.Text); } } } else if (_ModoAM == Negocios.FuncionesGlobales.Globales.Modo.Agregar) { _CategoriaN.Nombre = txtNombre.Text; if (_CategoriaN.Actualizar()) { MessageBox.Show("Se Actualizó la Categoria"); } else { MessageBox.Show("No se pudo Actulizar la Categoria"); } } LimpiarPantalla(); CambiarModoPantalla(Negocios.FuncionesGlobales.Globales.Modo.Inicial); }
protected void Page_Load(object sender, EventArgs e) { try { if (!Page.IsPostBack) { CategoriaN objN = new CategoriaN(); CondicionN ObjCon = new CondicionN(); if (!String.IsNullOrEmpty(this.Request.QueryString["cod"])) { var cod = this.Request.QueryString["cod"]; TxtCodigo.Text = cod; } DateTime fecha = DateTime.Now; //DDLCategoria.DataTextField = "Descripcion"; //DDLCategoria.DataValueField = "IdCategoria"; //DDLCategoria.DataSource = objN.ListarCategoria(); //DDLCategoria.DataBind(); //DDLCategoria.Items.Insert(0, " ----------------- Seleccione ----------------- "); //Listar Sede DDLSede.DataTextField = "Descripcion"; DDLSede.DataValueField = "IdSede"; DDLSede.DataSource = ObjSede.ListarSede("mantenimiento"); DDLSede.DataBind(); DDLSede.Items.Insert(0, " ----------------- Seleccione ----------------- "); TxtCodigo.Focus(); columnasGrid(); } else { dt = (DataTable)ViewState["dt"]; } } catch (Exception ex) { this.Page.Response.Write("<script language ='JavaScript'>window.alert('" + ex.Message + "');</script>"); } }
private void txtId_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter && txtId.Text == "") { CambiarModoPantalla(Negocios.FuncionesGlobales.Globales.Modo.Agregar); } else if (e.KeyCode == Keys.Enter && txtId.Text != "") { _CategoriaN = new CategoriaN(int.Parse(txtId.Text)); if (_CategoriaN.Nombre != null) { txtNombre.Text = _CategoriaN.Nombre; CambiarModoPantalla(Negocios.FuncionesGlobales.Globales.Modo.Consultar); } else { txtId.Text = ""; CambiarModoPantalla(Negocios.FuncionesGlobales.Globales.Modo.Agregar); } } }
private void CargarDatos() { CategoriaN objN = new CategoriaN(); SedeN ObjSede = new SedeN(); CondicionN ObjCond = new CondicionN(); UsuarioN ObjUsuario = new UsuarioN(); ddlCategoria.DataTextField = "Descripcion"; ddlCategoria.DataValueField = "IdCategoria"; ddlCategoria.DataSource = objN.ListarCategoria(); ddlCategoria.DataBind(); //ddlCategoria.Items.Insert(0, " ----------------- Seleccione ----------------- "); //Listar Sede ddlSede.DataTextField = "Descripcion"; ddlSede.DataValueField = "IdSede"; ddlSede.DataSource = ObjSede.ListarSede("partida"); ddlSede.DataBind(); //ddlSede.Items.Insert(0, " ----------------- Seleccione ----------------- "); //Listar Condición ddlCondicion.DataTextField = "Descripcion"; ddlCondicion.DataValueField = "IdCondicion"; ddlCondicion.DataSource = ObjCond.ListarCondicion(); ddlCondicion.DataBind(); ddlUsuario.DataTextField = "Nombre"; ddlUsuario.DataValueField = "IdLogin"; ddlUsuario.DataSource = ObjUsuario.ListarUsuario(); ddlUsuario.DataBind(); DateTime fecha = DateTime.Now; txtFechaDesde.Text = fecha.AddDays(-30).ToString("2017-01-31"); DateTime fecha2 = DateTime.Now; txtFechaHasta.Text = (fecha2.ToString("yyyy-MM-dd")); //txtFechaDesde.Text = DateTime.Now.AddDays(-20).ToShortDateString(); //txtFechaHasta.Text = DateTime.Now.ToShortDateString(); }
protected void Page_Load(object sender, EventArgs e) { try { if (!Page.IsPostBack) { CategoriaN objN = new CategoriaN(); CondicionN ObjCon = new CondicionN(); if (!String.IsNullOrEmpty(this.Request.QueryString["cod"])) { var cod = this.Request.QueryString["cod"]; TxtCodigo.Text = cod; } //if (Session["Perfil"] == null) //{ // return; //} //if (int.Parse(Session["Perfil"].ToString()) == 3) // si es perfil vigilancia //{ // this.Page.Response.Write("<script language ='JavaScript'>window.alert('<<Acceso Denegado>>');</script>"); // Response.Redirect("~/login.aspx"); //} // DateTime fecha = DateTime.Now; //TxtFecha.Text = fecha.ToShortDateString(); //Listar Categoria DDLCategoria.DataTextField = "Descripcion"; DDLCategoria.DataValueField = "IdCategoria"; DDLCategoria.DataSource = objN.ListarCategoria(); DDLCategoria.DataBind(); DDLCategoria.Items.Insert(0, " ----------------- Seleccione ----------------- "); //Listar Sede DDLSede.DataTextField = "Descripcion"; DDLSede.DataValueField = "IdSede"; DDLSede.DataSource = ObjSede.ListarSede("partida"); DDLSede.DataBind(); DDLSede.Items.Insert(0, " ----------------- Seleccione ----------------- "); TxtCodigo.Focus(); //Listar Condicion DDLCondicion.DataTextField = "Descripcion"; DDLCondicion.DataValueField = "IdCondicion"; DDLCondicion.DataSource = ObjCon.ListarCondicion(); DDLCondicion.DataBind(); //DDLCondicion.Items.Insert(0, " ----------------- Seleccione ----------------- "); Bloquear(); columnasGrid(); } else { dt = (DataTable)ViewState["dt"]; } } catch (Exception ex) { this.Page.Response.Write("<script language ='JavaScript'>window.alert('" + ex.Message + "');</script>"); } }