Beispiel #1
0
        private void btnAddUnit_Click(object sender, EventArgs e)
        {
            try
            {
                Unit_DTO unit = new Unit_DTO();
                unit.UnitID    = txtUnitID.Text;
                unit.UnitName  = txtUnitName.Text;
                unit.UnitPrice = txtUnitPrice.Text;

                if (txtUnitID.Text == "" || txtUnitName.Text == "" || txtUnitPrice.Text == "")
                {
                    XtraMessageBox.Show("You have to fullfill unit information!", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    ClearDisplay();
                    return;
                }

                if (Unit_BUS.InsertUnit(unit))
                {
                    XtraMessageBox.Show("Unit Info has been inserted sucessfully!", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    LoadUnitList();
                    ClearDisplay();
                    return;
                }
            }
            catch
            {
                XtraMessageBox.Show("Insert Info Failed!", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }