private void EliminarRegistro(String id) { clsNorma objNorma = new clsNorma(); DataSet dt = objNorma.ConsultarPNorma(id); int n = dt.Tables[0].Rows.Count; if (n == 0) { clsPNorma objPNorma = new clsPNorma(); objPNorma.ID = id; objPNorma.Eliminar(); } else lblMensaje.Text = "No es posible eliminarlo, ya que esta siendo utilizado."; }
protected void btnInsertar_Click(object sender, EventArgs e) { clsPNorma objPNorma = new clsPNorma(); if ((!this.txtNombre.Text.Equals(""))) { //aqui inserto un registro objPNorma.NOMBRE = this.txtNombre.Text; objPNorma.Insertar(); Response.Redirect("listaPNorma.aspx"); } else { this.lblMensaje.Text = "Faltan campos por llenar, intente nuevamente."; } }
protected void btnInsertar_Click(object sender, EventArgs e) { TextBox txtNombre = (TextBox)FormView1.FindControl("txtNombre"); clsPNorma objPNorma = new clsPNorma(); objPNorma.NOMBRE = txtNombre.Text; if ((this.IDEN != null) && (!objPNorma.NOMBRE.Equals(""))) { //aqui modifico el registro objPNorma.ID = this.IDEN; objPNorma.Modificar(); Response.Redirect("listaPNorma.aspx"); } else { Label lblMensaje = (Label)FormView1.FindControl("lblMensaje"); lblMensaje.Text = "Faltan campos por llenar, intente nuevamente."; } }
protected void btnInsertar_Click(object sender, EventArgs e) { DropDownList cbTipoNorma = (DropDownList)FormView1.FindControl("cbTipoNorma"); TextBox txtFecha = (TextBox)FormView1.FindControl("txtFecha"); TextBox txtNombre = (TextBox)FormView1.FindControl("txtNombre"); TextBox txtNumero = (TextBox)FormView1.FindControl("txtNumero"); TextBox txtRuta = (TextBox)FormView1.FindControl("txtRuta"); RadioButtonList rbtnListNorma = (RadioButtonList)FormView1.FindControl("rbtnListNorma"); RadioButtonList rbtnListEstado = (RadioButtonList)FormView1.FindControl("rbtnListEstado"); Label lblMensaje = (Label)FormView1.FindControl("lblMensaje"); clsNorma objNorma = new clsNorma(); clsPNorma ti = new clsPNorma(); objNorma.TIPO = cbTipoNorma.SelectedItem.Value + ""; objNorma.URL = txtRuta.Text; if ((objNorma.URL.Contains(".")) && (!txtNombre.Text.Equals("")) && (!txtNumero.Text.Equals("")) && (!txtFecha.Equals("")) && (!txtRuta.Text.Equals("")) && (ValidarNumero(txtNumero.Text))) { //aqui inserto un registro objNorma.ID = this.IDEN; objNorma.NOMBRE = txtNombre.Text; objNorma.NUMERO = txtNumero.Text; objNorma.FECHAACT = DateTime.Today.Day + "/" + DateTime.Today.Month + "/" + DateTime.Today.Year; if (!txtFecha.Text.Equals("")) objNorma.FECHA = txtFecha.Text.Substring(0,10); else objNorma.FECHA = objNorma.FECHAACT; HttpCookie objCookie1 = Request.Cookies.Get("idUsuario"); String idUsuario = objCookie1.Value; objNorma.USUARIO = idUsuario; objNorma.NORMA = rbtnListNorma.SelectedValue; objNorma.ESTADO = rbtnListEstado.SelectedValue; EliminarRegistrosDePalClaves(); objNorma.Modificar(); InsertarPalabrasClaves(this.IDEN); this.EnviarAlertas(); Response.Redirect("listaNorma.aspx"); } else { lblMensaje.Text = "Faltan campos por llenar, intente nuevamente."; } }
protected void btnInsertar_Click(object sender, EventArgs e) { clsNorma objNorma = new clsNorma(); clsPNorma ti = new clsPNorma(); DataSet d = ti.ConsultarPorNombre(cbTipoNorma.SelectedValue); objNorma.TIPO = d.Tables[0].Rows[0].ItemArray[0] + ""; objNorma.URL = this.txtRuta.Text; if ((objNorma.URL.Contains(".")) && (!this.txtNombre.Text.Equals("")) && (!this.txtNumero.Text.Equals("")) && (!this.txtFecha.Text.Equals("")) && (!this.txtRuta.Text.Equals("")) && (ValidarNumero(this.txtNumero.Text))) { //aqui inserto un registro objNorma.NOMBRE = this.txtNombre.Text; objNorma.NUMERO = this.txtNumero.Text; String str = DateTime.Today.Month + ""; if (str.Length == 1) str = "0" + str; objNorma.FECHAACT = DateTime.Today.Year + "" + str + "" + DateTime.Today.Day; if (!this.txtFecha.Text.Equals("")) objNorma.FECHA = this.txtFecha.Text; else objNorma.FECHA = objNorma.FECHAACT; String year = objNorma.FECHA.Substring(6, 4); String month = objNorma.FECHA.Substring(3, 2); String day = objNorma.FECHA.Substring(0, 2); objNorma.FECHA = year + "" + month + "" + day; HttpCookie objCookie1 = Request.Cookies.Get("idUsuario"); String idUsuario = objCookie1.Value; objNorma.USUARIO = idUsuario; if (rbtnSi.Checked) objNorma.ESTADO = "si"; else objNorma.ESTADO = "no"; if (rbtnInfor.Checked) objNorma.NORMA = "1"; else { if (rbtnCumpli.Checked) objNorma.NORMA = "2"; else objNorma.NORMA = "3"; } int identificador = objNorma.Insertar(); InsertarPalabrasClaves(identificador); this.EnviarAlertas(); Response.Redirect("listaNorma.aspx"); } else { this.lblMensaje.Text = "Faltan campos por llenar, intente nuevamente."; } }
private void CargarCombos() { clsPNorma objPNorma = new clsPNorma(); DataSet d = objPNorma.ConsultarTodosLosRegistros(); int n = d.Tables[0].Rows.Count; for (int i = 0; i < n; i++) { cbTipoNorma.Items.Add((String)d.Tables[0].Rows[i].ItemArray[2]); } }