示例#1
0
 private void btn_Eliminar_Click(object sender, EventArgs e)
 {
     try
     {
         DialogResult Opcion;
         Opcion = MessageBox.Show("Realmente desea Eliminar los Registros", "Sistema de Ventas", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
         if (Opcion == DialogResult.OK)
         {
             string Codigo;
             string Rpta = "";
             foreach (DataGridViewRow row in dataListado.Rows)
             {
                 if (Convert.ToBoolean(row.Cells[0].Value))
                 {
                     Codigo = Convert.ToString(row.Cells[1].Value);
                     Rpta   = NSectores.Eliminar(Convert.ToInt32(Codigo));
                 }
                 if (Rpta.Equals("OK"))
                 {
                     this.MensageOk("Se Elimino Correctamente el Registro");
                 }
                 else
                 {
                     this.MensageError(Rpta);
                 }
             }
         }
         this.Mostrar();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message + ex.StackTrace);
     }
 }
示例#2
0
 private void btn_Guardar_Click(object sender, EventArgs e)
 {
     try
     {
         string rpta = "";
         if (this.txt_Sector.Text == string.Empty)
         {
             MensageError("Faltan ingresar Datos");
             errorIcono.SetError(txt_Sector, "Ingrese una Sector");
         }
         else
         {
             if (this.IsNuevo)
             {
                 rpta = NSectores.Insertar(this.txt_Sector.Text.Trim().ToUpper(), Convert.ToInt32(this.cb_Provincia.SelectedValue));
             }
             else
             {
                 rpta = NSectores.Editar(Convert.ToInt32(txt_Codigo.Text),
                                         this.txt_Sector.Text.Trim().ToUpper(), Convert.ToInt32(this.cb_Provincia.SelectedValue));
             }
             if (rpta.Equals("OK"))
             {
                 if (this.IsNuevo)
                 {
                     this.MensageOk("Se Inseto de Forma Correcta");
                 }
                 else
                 {
                     this.MensageOk("Se Actualizo de Forma Correcta");
                 }
             }
             else
             {
                 this.MensageError(rpta);
             }
             this.IsNuevo  = false;
             this.IsEditar = false;
             this.Botones();
             this.Limpiar();
             this.Mostrar();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message + ex.StackTrace);
     }
 }
示例#3
0
 //Metodo Buscar Nombre
 private void BuscarNombre()
 {
     this.dataListado.DataSource = NSectores.BuscarNombre(this.txt_Buscar.Text);
     this.Ocultar_Columnas();
     this.lbl_Total.Text = "Total de Registros:" + Convert.ToString(dataListado.Rows.Count);
 }
示例#4
0
 //Metodo Mostrar
 private void Mostrar()
 {
     this.dataListado.DataSource = NSectores.Mostrar();
     this.Ocultar_Columnas();
     this.lbl_Total.Text = "Total de Registros:" + Convert.ToString(dataListado.Rows.Count);
 }