예제 #1
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         string res = "";
         if (this.txtSerie.Text == string.Empty || this.txtSequence.Text == string.Empty ||
             this.txtIva.Text == string.Empty)
         {
             MessageError("Faltan datos obligatorios");
             errorInput.SetError(txtSerie, "Introduzca un valor");
             errorInput.SetError(txtSequence, "Introduzca un valor");
             errorInput.SetError(txtIva, "Introduzca un valor");
         }
         else
         {
             if (this.IsNew)
             {
                 res = EntryController.Insert(this.dtpEntryDate.Value, this.cbxTypeReceipt.Text, this.txtSerie.Text.Trim(), this.txtSequence.Text.Trim(), Convert.ToDecimal(this.txtIva.Text), "EMITIDO", IdEmployee, Convert.ToInt32(this.cbxProvider.SelectedValue), DtDetail);
             }
             if (res.Equals("Correcto"))
             {
                 if (this.IsNew)
                 {
                     this.MessageOK("¡Se ha insertado el registro!");
                 }
             }
             else
             {
                 this.MessageError(res);
             }
             this.IsNew = false;
             this.EnableButtons();
             this.ResetForm();
             this.ShowData();
             this.ResetItem();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message + ex.StackTrace);
     }
 }