示例#1
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);
     }
 }