protected void BtnNuevo_Click1(object sender, ImageClickEventArgs e) { //txtFechaCompra.Text = DateTime.Parse("2017-01-31").ToString("yyyy-MM-dd"); //último cambio //txtFechaFin.Text = DateTime.Parse("2017-01-31").ToString("yyyy-MM-dd"); DateTime fecha = DateTime.Now; txtFechaCompra.Text = (fecha.ToString("yyyy-MM-dd")); txtFechaFin.Text = (fecha.ToString("yyyy-MM-dd")); //txtFechaFin.Text = (fecha.ToString("yyyy-MM-dd")); //txtTiempo.Text = "0"; limpiar(); BtnGraba.Enabled = true; lblgrabar.Enabled = true; txtRuc.Enabled = true; txtFechaCompra.Enabled = true; //no estoy segura ver txtTiempo.Enabled = true; txtNroFactura.Enabled = true; BtnGraba.Visible = true; lblgrabar.Visible = true; BtnModificar.Visible = false; txtUsu.Enabled = true; txtModelo.Enabled = true; txtSerie.Enabled = true; txtMarca.Enabled = true; Habilitar(); //Listar Sede DDLSede.DataTextField = "Descripcion"; DDLSede.DataValueField = "IdSede"; DDLSede.DataSource = ObjSede.ListarSede("mantenimiento"); DDLSede.DataBind(); DDLSede.Items.Insert(0, " ----------------- Seleccione ----------------- "); }
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 bool validarCampos(string tipo) { bool b = false; try { LogisticaN objBuscar = new LogisticaN(); string xcodigo = TxtCod.Text.Trim(); if (tipo == "insert") { DataTable DTILogistica = objBuscar.BuscarLogistica(xcodigo); if (DTILogistica.Rows.Count > 0) { TxtCod.Focus(); throw new Exception("El Codigo ya Existe"); } } else { if (TxtCod.Text.Trim() != TxtCodigo.Text.Trim()) { if (objBuscar.fun_validar_noRepetir_cod(xcodigo) > 0) { TxtCod.Focus(); throw new Exception("El Codigo ya Existe"); } } } if (String.IsNullOrEmpty(TxtCod.Text)) { TxtCod.Focus(); throw new Exception("Ingrese el código"); } if (String.IsNullOrEmpty(TxtDescripcion.Text)) { TxtDescripcion.Focus(); throw new Exception("Ingrese Descripción"); } if (DDLSede.SelectedIndex == 0) { DDLSede.Focus(); throw new Exception("Seleccione Sede"); } if (String.IsNullOrEmpty(TxtArea.Text)) { TxtArea.Focus(); throw new Exception("Ingrese Area"); } if (String.IsNullOrEmpty(TxtPiso.Text)) { TxtPiso.Focus(); throw new Exception("Ingrese Piso"); } if (String.IsNullOrEmpty(txtEdificio.Text)) { txtEdificio.Focus(); throw new Exception("Ingrese Edificio"); } if (String.IsNullOrEmpty(txtUsu.Text)) { txtUsu.Focus(); throw new Exception("Asigne un Usuario"); } if (DDLCategoria.SelectedIndex == 0) { DDLCategoria.Focus(); throw new Exception("Seleccione Categoria"); } if (tipo == "insert") { validar_campos_ruc(); } else { if (DateTime.Parse(hdFecha.Value) > DateTime.Parse("2018-12-31")) { validar_campos_ruc(); } } b = true; return(b); } catch (Exception ex) { this.Page.Response.Write("<script language ='JavaScript'>window.alert('" + ex.Message + "');</script>"); return(false); } }
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>"); } }