private void showInforCus() { htEntities context = new htEntities(); ObjectParameter MaKH = new ObjectParameter("MaKH", typeof(string)); ObjectParameter tenkh = new ObjectParameter("tenkh", typeof(string)); ObjectParameter soCMND = new ObjectParameter("soCMND", typeof(string)); ObjectParameter diachi = new ObjectParameter("diachi", typeof(string)); ObjectParameter sdt = new ObjectParameter("sdt", typeof(string)); ObjectParameter tennv = new ObjectParameter("tennv", typeof(string)); context.getCusFrPhieuThue3(textBoxMaPhieuThue.Text, MaKH, tenkh, soCMND, diachi, sdt, tennv); labelmaKH.Text = MaKH.Value.ToString(); labeltenKH.Text = tenkh.Value.ToString(); labelsoCMND.Text = soCMND.Value.ToString(); labelDiaChi.Text = diachi.Value.ToString(); labelSDT.Text = sdt.Value.ToString(); labelnvLap.Text = tennv.Value.ToString(); if (labelnvLap.Text == "") { labelnvLap.Text = "Nhân viên đã nghỉ"; } }
private void btnLogin_Click(object sender, EventArgs e) { Encrypt enc = new Encrypt(); htEntities context = new htEntities(); List <NhanVien> list = getPass(); username = textBoxUserName.Text; password = enc.MaHoa(textBoxPassWord.Text); var check = list.Where(item => item.TenTk != null && item.TenTk.Equals(username)).ToList(); if (check.Count > 0) { if (check[0].MatKhau.Equals(password)) { MessageBox.Show("Đăng nhập thành công"); this.Close(); th = new Thread(openMainForm); th.SetApartmentState(ApartmentState.STA); th.Start(); } else { MessageBox.Show("Mật khẩu không chính xác"); } } else { MessageBox.Show("Không tồn tại tài khoản này"); } }
private void MainForm_Load(object sender, EventArgs e) { using (htEntities context = new htEntities()) { string tenNV = context.wellCome(LoginForm.username, LoginForm.password).FirstOrDefault(); labelWellCome.Text = "Xin chào,\n" + tenNV; } }
private void showtienDvDetail(DataGridView dgv) { htEntities context = new htEntities(); dgv.DataSource = context.tienDvDetail(textBoxMaPhieuThue.Text); dgv.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; dgv.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells; }
private void showListBill(DataGridView dgv) { htEntities context = new htEntities(); dgv.DataSource = context.getlistBill(); dgv.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; dgv.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells; }
void showTienTheoPhong(DataGridView dgv1, DataGridView dgv2) { htEntities context = new htEntities(); dgv1.DataSource = context.ViewTienPhong(dtpNgayVao.Value, dtpNgaydi.Value); dgv2.DataSource = context.ViewTienDV(dtpNgayVao.Value, dtpNgaydi.Value); dgv2.AutoSizeColumnsMode = dgv1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; dgv2.AutoSizeRowsMode = dgv1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells; }
private void MainForm_Load(object sender, EventArgs e) { using (htEntities context = new htEntities()) { string tenNV = context.wellCome(LoginForm.username, LoginForm.password).FirstOrDefault(); labelWellCome.Text = "Xin chào,\n" + tenNV; quyen = Convert.ToByte(context.getPermission(LoginForm.username, LoginForm.password).FirstOrDefault()); if (quyen == 0) { btnNhanVien.Visible = btnNguoiDung.Visible = btnPhong.Visible = btnLoaiPhong.Visible = bntDichVu.Visible = btnLoaiDV.Visible = false; panelQuanLy.Size = new System.Drawing.Size(183, 40); } } }
private void btnThanhToan_Click(object sender, EventArgs e) { string maphieuthue = ""; for (int i = 0; i < dgvListBill.Rows.Count; i++) { maphieuthue = dgvListBill.Rows[i].Cells[7].Value.ToString(); } htEntities context = new htEntities(); if (btncreateBill.Text == "Tạo Hóa Đơn") { if (textBoxMaPhieuThue.Text != maphieuthue) { context.creatBill(labelIdHD.Text, Convert.ToInt32(labelTP.Text), Convert.ToInt32(labelTDV.Text), Convert.ToInt32(labeltongT.Text), dateTimePickerNgayTT.Value, textBoxghiChu.Text, textBoxMaPhieuThue.Text, labelMaHTTT.Text); try { DialogResult result = MessageBox.Show("Tạo hóa đơn thành công, bạn có muốn in hóa đơn hay không?", "Thông báo", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { passData(); showTableinReport(); showListBill(dgvListBill); //ExportBill asd = new ExportBill(); //asd.Show(); } else if (result == DialogResult.No) { } comboBoxHTTT.Text = ""; //btncreateBill.Enabled = false; } catch (Exception ex) { MessageBox.Show(ex.Message); } } else { MessageBox.Show("phiếu thuê phòng này đã được tạo hóa đơn!!!"); } } else if (btncreateBill.Text == "In Hóa Đơn") { passData(); showTableinReport(); } }
private void btnSearch_Click(object sender, EventArgs e) { htEntities context = new htEntities(); if (textBoxMaPhong.Text != "Nhập mã phòng") { textBoxMaPhieuThue.Text = context.getIdPTFromMaPhong(textBoxMaPhong.Text).FirstOrDefault().ToString(); btncreateBill.Text = "Tạo Hóa Đơn"; } else { MessageBox.Show("Bạn chưa nhập mã phòng"); } implementID(); }
private void btnThanhToan_Click(object sender, EventArgs e) { htEntities context = new htEntities(); if (btncreateBill.Text == "Tạo Hóa Đơn") { if (comboBoxHTTT.Text == "Thẻ") { comboBoxHTTT.Text = "True"; } else { comboBoxHTTT.Text = "False"; } context.creatBill(labelIdHD.Text, Convert.ToInt32(labelTP.Text), Convert.ToInt32(labelTDV.Text), Convert.ToInt32(labeltongT.Text), Convert.ToBoolean(comboBoxHTTT.Text), dateTimePickerNgayTT.Value, textBoxghiChu.Text, textBoxMaPhieuThue.Text); try { DialogResult result = MessageBox.Show("Tạo hóa đơn thành công, bạn có muốn in hóa đơn hay không?", "Thông báo", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { passData(); showTableinReport(); //ExportBill asd = new ExportBill(); //asd.Show(); } else if (result == DialogResult.No) { } comboBoxHTTT.Text = ""; //btncreateBill.Enabled = false; } catch (Exception ex) { MessageBox.Show(ex.Message); } } else if (btncreateBill.Text == "In Hóa Đơn") { passData(); showTableinReport(); } }
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); } }
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"); } } }
//private void FillComboboxMPT() //{ // htEntities context = new htEntities(); // var getIdMptList = from PhieuThuePhong in context.PhieuThuePhongs // select PhieuThuePhong; // comboBoxMaPT.DataSource = getIdMptList.ToList(); // comboBoxMaPT.DisplayMember = "MaPhieuThuePhong"; //comboBoxMaPT.ValueMember = "MaSD"; // comboBoxMaPT.Items.Add("select one"); // foreach (var item in getIdMptList) // { // comboBoxMaPT.Items.Add(Contains(item)); // } //} //} private void FillComboboxHTTT() { htEntities context = new htEntities(); comboBoxHTTT.DataSource = context.getHTTT(); }
private void btnSearch_Click(object sender, EventArgs e) { htEntities context = new htEntities(); textBoxMaPhieuThue.Text = context.getIdPTFromMaPhong(textBoxMaPhong.Text).FirstOrDefault().ToString(); }
public List <NhanVien> getPass() { htEntities context = new htEntities(); return(context.NhanViens.ToList()); }
private void comboBoxPhongsdDV_TextChanged(object sender, EventArgs e) { htEntities DVRoom = new htEntities(); lableIdCTPT.Text = DVRoom.TKidCTPTofRoom(comboBoxPhongsdDV.Text).FirstOrDefault().ToString(); }
private void textBoxMaPhieuThue_TextChanged(object sender, EventArgs e) { showtienphongDetail(dgvTienPhongDetail); showtienDvDetail(dgvTienDvDetail); showTien(); htEntities context = new htEntities(); //string mpt = Convert.ToString(comboBoxMaPT.Text); //var result = context.KhachHangs.Select(p => p.MaKH).FirstOrDefault(); //labelmaKH.Text = result; var result = from c in context.PhieuThuePhongs where c.MaPhieuThuePhong == textBoxMaPhieuThue.Text select c.MaKH; var result1 = from c in context.PhieuThuePhongs where c.MaPhieuThuePhong == textBoxMaPhieuThue.Text select new { c.NhanVien.HoTen }; var result2 = from c in context.PhieuThuePhongs where c.MaPhieuThuePhong == textBoxMaPhieuThue.Text select new { c.KhachHang.TenKH }; var result3 = from c in context.PhieuThuePhongs where c.MaPhieuThuePhong == textBoxMaPhieuThue.Text select new { c.KhachHang.SoCMND }; var result4 = from c in context.PhieuThuePhongs where c.MaPhieuThuePhong == textBoxMaPhieuThue.Text select new { c.KhachHang.DiaChi }; var result5 = from c in context.PhieuThuePhongs where c.MaPhieuThuePhong == textBoxMaPhieuThue.Text select new { c.KhachHang.SDT }; labelmaKH.Text = result.FirstOrDefault(); string nvlap = result1.FirstOrDefault().ToString(); string nvlap2 = nvlap.Substring(10); string[] arr = nvlap2.Split(new char[] { '}' }); labelnvLap.Text = arr[0]; string tenkh = result2.FirstOrDefault().ToString(); string tenkh2 = tenkh.Substring(10); string[] arr2 = tenkh2.Split(new char[] { '}' }); labeltenKH.Text = arr2[0]; string soCM = result3.FirstOrDefault().ToString(); string soCM2 = soCM.Substring(11); string[] arr3 = soCM2.Split(new char[] { '}' }); labelsoCMND.Text = arr3[0]; string dc = result4.FirstOrDefault().ToString(); string dc2 = dc.Substring(11); string[] arr4 = dc2.Split(new char[] { '}' }); labelDiaChi.Text = arr4[0]; string sdt = result5.FirstOrDefault().ToString(); string sdt2 = sdt.Substring(8); string[] arr5 = sdt2.Split(new char[] { '}' }); labelSDT.Text = arr5[0]; }