Ejemplo n.º 1
0
        private void NewButton_Click(object sender, EventArgs e)
        {
            string message = "";

            if (string.IsNullOrEmpty(UsernameTextbox.Text))
            {
                message += "– Tên đăng nhập bị bỏ trống." + Environment.NewLine;
            }
            if (string.IsNullOrEmpty(PasswordTextbox.Text))
            {
                message += "– Mật khẩu bị bỏ trống." + Environment.NewLine;
            }
            if (string.IsNullOrEmpty(FullNameTextbox.Text))
            {
                message += "– Họ tên bị bỏ trống." + Environment.NewLine;
            }

            if (!string.IsNullOrEmpty(message))
            {
                message = "Tạo nhân viên mới thất bại vì (những) lý do sau:" + Environment.NewLine + message;
            }
            else
            {
                IdNumericUpdown.Value
                    = LazyWorker <Employee> .Insert(FilledDataToEmployee());

                message = "Tạo mới thành công!";
                LoadAllEmployees();
            }
            MessageBox.Show(message);
        }
Ejemplo n.º 2
0
        private void NewRoomButton_Click(object sender, EventArgs e)
        {
            RoomIdNumericUpDown.Value
                = LazyWorker <Room> .Insert(FilledDataToRoom());

            LoadAllRooms(Int32.MaxValue);
            FormUtilities.NotifySuccess();
        }
Ejemplo n.º 3
0
        private void NewServiceButton_Click(object sender, EventArgs e)
        {
            ServiceIdNumericUpDown.Value = LazyWorker <ServiceModel> .Insert(FilledDataToService());

            LoadAllServices();
            FormUtilities.SetRowIndex(ServiceGridView);
            SaveServiceButton.Enabled   = true;
            DeleteServiceButton.Enabled = true;
            FormUtilities.NotifySuccess();
        }
Ejemplo n.º 4
0
 private void NewButton_Click(object sender, EventArgs e)
 {
     if
     (
         (IdNumericUpdown.Value
              = LazyWorker <Customer> .Insert(FilledDataToCustomer())) > 0
     )
     {
         LoadAllCustomer();
         FormUtilities.NotifySuccess();
     }
 }
Ejemplo n.º 5
0
        private void NewBillButton_Click(object sender, EventArgs e)
        {
            BillModel bill = new BillModel()
            {
                CustomerId  = (CustomerComboBox.SelectedIndex == 0 ? null : (int?)CustomerComboBox.SelectedIndex),
                EmployeeId  = (EmployeeComboBox.SelectedIndex == 0 ? null : (int?)EmployeeComboBox.SelectedIndex),
                CreatingDay = DateTime.Today.Date
            };

            bill.Id = LazyWorker <BillModel> .Insert(bill);

            SetCurrentBill(LessLazyWorker.BillModelToBillDisplay(bill));
        }
Ejemplo n.º 6
0
 private void AddServiceButton_Click(object sender, EventArgs e)
 {
     if (currentBill.Id == 0 || ServiceComboBox.SelectedIndex == 0)
     {
         FormUtilities.NotifyFailure();
         return;
     }
     if (LazyWorker <BillDetail> .Insert(FilledDataToBillDetail()) > 0)
     {
         LoadBillsServices();
         FormUtilities.NotifySuccess();
     }
     else
     {
         FormUtilities.NotifyFailure();
     }
 }