Esempio n. 1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                string resp = "";
                if (txtidSupplier.Text == string.Empty || txtSerie.Text == string.Empty)
                {
                    MessageError("Fill the fields");
                    errorIcon.SetError(txtidSupplier, "Insert the supply");
                    errorIcon.SetError(txtIdProduct, "Insert the product id");
                    errorIcon.SetError(txtSerie, "Insert the serie");
                }
                else
                {
                    if (this.isNew)
                    {
                        resp = BInput.Insert(idstaff, Convert.ToInt32(this.txtidSupplier.Text), Convert.ToDateTime(this.dtpDate.Text),
                                             this.cbReceipt.Text, txtSerie.Text, txtCorelativ.Text, Convert.ToDecimal(txtVat.Text),
                                             "ISSUED", dtDetails);
                    }


                    if (resp.Equals("OK"))
                    {
                        if (this.isNew)
                        {
                            this.MessageOk("Register saved");
                        }
                    }
                    else
                    {
                        this.MessageError(resp);
                    }

                    this.isNew = false;
                    this.Enabledbuttons();
                    this.Clean();
                    this.ShowDetailInput();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }