예제 #1
0
 private void iconButtonSave_Click(object sender, EventArgs e)
 {
     if (status == true)
     {
         cus.addCus(textBoxMaKH.Text, textBoxTenKH.Text, textBoxSoCMND.Text, textBoxDiaChi.Text, textBoxSDT.Text);
         try
         {
             MessageBox.Show("Them KH thanh cong");
             cus.SaveChanges();
             ShowCus(dgvCustomers);
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
     }
     else
     {
         cus.updateCus(textBoxMaKH.Text, textBoxTenKH.Text, textBoxSoCMND.Text, textBoxDiaChi.Text, textBoxSDT.Text);
         try
         {
             MessageBox.Show("cap nhat thong tin khach hang thanh cong");
             cus.SaveChanges();
             ShowCus(dgvCustomers);
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
     }
     clearText();
     lockText();
     implementID();
 }
예제 #2
0
 private void iconButtonSave_Click_1(object sender, EventArgs e)
 {
     if (status == true)
     {
         ser.addSer(tbMa.Text, tbTen.Text, Convert.ToInt32(tbGia.Text), comboBox1.Text);
         try
         {
             MessageBox.Show("Thêm Dịch Vụ Thành Công");
             ser.SaveChanges();
             ShowSer(dgvServices);
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
     }
     else
     {
         ser.updateSer(tbMa.Text, tbTen.Text, Convert.ToInt32(tbGia.Text), comboBox1.Text);
         try
         {
             MessageBox.Show("Cập Nhật Dịch Vụ Thành Công!");
             ser.SaveChanges();
             ShowSer(dgvServices);
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
     }
     clearText();
     lockText();
     serviceID();
 }
예제 #3
0
 private void iconButtonSave_Click(object sender, EventArgs e)
 {
     if (status == true)
     {
         emp.addEmp(textBoxMaNV.Text, textBoxHoTenNV.Text, dateTimePickerEmp.Value, textBoxSDT.Text);
         try
         {
             MessageBox.Show("Them nhan vien thanh cong");
             emp.SaveChanges();
             ShowEmp(dgvEmp);
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
     }
     else
     {
         emp.updateEmp(textBoxMaNV.Text, textBoxHoTenNV.Text, dateTimePickerEmp.Value, textBoxSDT.Text);
         try
         {
             MessageBox.Show("cap nhat thong tin nhan vien thanh cong");
             emp.SaveChanges();
             ShowEmp(dgvEmp);
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
     }
     clearText();
     lockText();
     implementID();
 }
예제 #4
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (status == true)
     {
         DVRoom.addServiceRoom(labelIdSD.Text, Convert.ToDateTime(dateTimePickerNgayTT.Value), Convert.ToByte(textBoxSL.Text), Convert.ToInt32(textBoxGiaTien.Text), textBoxMaDV.Text, lableIdCTPT.Text);
         try
         {
             MessageBox.Show("Thêm thông tin phiếu sử dụng dịch vụ thành công ");
             DVRoom.SaveChanges();
             ShowDVRoom(dvgPhieuSDDV);
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
     }
     else
     {
         DVRoom.UpdateServiceRoom(labelIdSD.Text, Convert.ToDateTime(dateTimePickerNgayTT.Value), Convert.ToByte(textBoxSL.Text), Convert.ToInt32(textBoxGiaTien.Text), textBoxMaDV.Text, lableIdCTPT.Text);
         try
         {
             MessageBox.Show("Cập nhật thông tin phiếu sử dụng dịch vụ thành công!");
             DVRoom.SaveChanges();
             ShowDVRoom(dvgPhieuSDDV);
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
     }
     clearText();
     lockText();
     serviceRoomID();
 }
예제 #5
0
 private void iconButtontraPhong_Click(object sender, EventArgs e)
 {
     context.changeStatusRoom(textBoxMaPhong.Text);
     context.updateNgayRa(textBoxMaCTPT.Text, ngayra.Value);
     context.SaveChanges();
     showPhongThue(dgvRentedRoom);
     showFreeRoom(dgvfreeRoom);
 }
예제 #6
0
 private void iconButtonSave_Click(object sender, EventArgs e)
 {
     if (comboBoxhtt.Text == "Online")
     {
         comboBoxhtt.Text = "True";
     }
     else
     {
         comboBoxhtt.Text = "False";
     }
     context.changeStatusRoom(textBoxMaPhong.Text);
     if (status == true)
     {
         context.add_CTPT(lableIdCTPT.Text, dtpNgayVao.Value, Convert.ToBoolean(comboBoxhtt.Text), Convert.ToByte(textBoxSoNguoi.Text), textBoxMaPhong.Text, labelIdPT.Text);
         try
         {
             MessageBox.Show("Them ctpt thanh cong");
             context.SaveChanges();
             showFreeRoom(dgvFreeRoom);
             showCTPT(dgvDSCTPT);
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
     }
     else
     {
         context.update_CTPT(lableIdCTPT.Text, dtpNgayVao.Value, Convert.ToBoolean(comboBoxhtt.Text), Convert.ToByte(textBoxSoNguoi.Text), textBoxMaPhong.Text, labelIdPT.Text);
         context.changeStatusRoom(maphongSua);
         try
         {
             MessageBox.Show("cap nhat chi tiet phieu thue thanh cong");
             context.SaveChanges();
             showCTPT(dgvDSCTPT);
             showFreeRoom(dgvFreeRoom);
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
     }
     clearText();
     implementID();
 }
예제 #7
0
 private void btnXoa_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("xoa khach hang nay?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
     {
         user.delEmp(textBoxMaNV.Text);
         try
         {
             MessageBox.Show("xoa tai khoan thành công");
             user.SaveChanges();
             showUsers(dgvUsers);
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
         clearText();
         btnXoa.Enabled = false;
         //textBoxMaKH.Text = "";
     }
 }
예제 #8
0
 //Xoa dich vu
 private void btnXoa_Click_1(object sender, EventArgs e)
 {
     if (MessageBox.Show("Xóa Loại Dịch Vụ Này?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
     {
         TypeSer.delTypeSer(textBoxMaloaidv.Text);
         try
         {
             MessageBox.Show("Xóa Loại Dịch Vụ Thành Công");
             TypeSer.SaveChanges();
             ShowSer(dgvLoaiDV);
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
         clearText();
         btnXoa.Enabled       = false;
         textBoxMaloaidv.Text = "";
     }
 }
예제 #9
0
 private void btnXoa_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Xóa Loại Phòng Này?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
     {
         TypeRoom.delTypeRoom(textBoxMaLoaiPhong.Text);
         try
         {
             MessageBox.Show("Xóa Loại Phòng Thành Công");
             TypeRoom.SaveChanges();
             ShowTypeRoom(dgvLoaiPhong);
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
         clearText();
         btnXoa.Enabled          = false;
         textBoxMaLoaiPhong.Text = "";
     }
 }
예제 #10
0
 private void btnDkyThue_Click(object sender, EventArgs e)
 {
     context.addPhieuThuePhong(lableIdPT.Text, textBoxNote.Text, textBoxMaKH.Text, textBoxMaNV.Text);
     try
     {
         MessageBox.Show("Them phieu thue phong thanh cong");
         context.SaveChanges();
         showDsPhieuThue(dgvDSphieuThue);
         openChildForm(new ChiTietDatPhongForm());
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
예제 #11
0
        private void btntiep_Click(object sender, EventArgs e)
        {
            status = true;
            htEntities context = new htEntities();

            context.addPhieuThuePhong(lableIdPT.Text, textBoxNote.Text, comboBoxMKH.Text, textBoxMaNV.Text);
            try
            {
                DialogResult result = MessageBox.Show("Thêm phiếu thuê phòng thành công !!! Bạn có muốn thêm phòng cho khách hàng luôn?", "Thông báo", MessageBoxButtons.YesNo);
                context.SaveChanges();
                if (result == DialogResult.Yes)
                {
                    openChildForm(new ChiTietDatPhongForm());
                }
                else
                {
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
예제 #12
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     using (htEntities context = new htEntities())
     {
         if (textBoxMkCu.Text == LoginForm.password && textBoxMkMoi.Text == textBoxMkMoiR.Text)
         {
             string idEmp = context.getIdNV(LoginForm.username, LoginForm.password).FirstOrDefault();
             context.changePass(textBoxMkMoi.Text, idEmp);
             try
             {
                 MessageBox.Show("doi mk thanh cong");
                 context.SaveChanges();
             }
             catch (Exception ex)
             {
                 MessageBox.Show(ex.Message);
             }
             textBoxMkCu.Text = textBoxMkMoi.Text = textBoxMkMoiR.Text = "";
         }
         else if (textBoxMkCu.Text == "")
         {
             MessageBox.Show("vui long nhap mk cu");
         }
         else if (textBoxMkMoi.Text == "")
         {
             MessageBox.Show("vui long nhap mk moi");
         }
         else if (textBoxMkMoi.Text != textBoxMkMoiR.Text)
         {
             MessageBox.Show("mk khong khop");
         }
         else
         {
             MessageBox.Show("mk cu khong chinh xac");
         }
     }
 }