Ejemplo n.º 1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            DataSet ds = new DataSet();

            try
            {
                ContractDTO obj = new ContractDTO();
                obj.IDHouse    = Convert.ToInt64((cboHouse.SelectedItem as clsComboItem).Value);
                obj.IDCustomer = Convert.ToInt64((cboCustomer.SelectedItem as clsComboItem).Value);
                obj.IDEmployee = Convert.ToInt64((cboEmployee.SelectedItem as clsComboItem).Value);

                ds = ContractDAO.Contract_InsUpd(obj);
                if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0 && Convert.ToInt32(ds.Tables[0].Rows[0]["Result"]) == 1)
                {
                    clsMessages.ShowInformation("Thêm thành công!");
                    frmParent.LoadDataToForm();
                    this.Close();
                }
                else
                {
                    clsMessages.ShowWarning("Thêm thất bại!");
                }
            }
            catch (Exception ex)
            {
                clsMessages.ShowErrorException(ex);
            }
            finally
            {
                ds.Dispose();
            }
        }