public static bool edit(LoaiNguyenLieu loaiNguyenLieu)
        {
            LoaiNguyenLieu temp = find(loaiNguyenLieu.maLoaiNguyenLieu);

            if (temp == null || !CServices.kiemTraThongTin(loaiNguyenLieu))
            {
                return(false);
            }
            try
            {
                temp.maLoaiNguyenLieu  = loaiNguyenLieu.maLoaiNguyenLieu;
                temp.tenLoaiNguyenLieu = loaiNguyenLieu.tenLoaiNguyenLieu;
                quanLyQuanCoffee.SaveChanges();
            }
            catch (DbUpdateException)
            {
                MessageBox.Show("Lỗi! không thể thêm dữ liệu vào database");
                return(false);
            }
            catch (DbEntityValidationException)
            {
                MessageBox.Show("Lỗi! kiểu dữ liệu không hợp lệ");
                return(false);
            }
            return(true);
        }
Ejemplo n.º 2
0
        public static bool add(NhanVien nhanVien)
        {
            if (CServices.kiemTraThongTin(nhanVien))
            {
                try
                {
                    nhanVien.hoNhanVien  = CServices.formatChuoi(nhanVien.hoNhanVien);
                    nhanVien.tenNhanVien = CServices.formatChuoi(nhanVien.tenNhanVien);
                    nhanVien.hoNhanVien  = CServices.formatChuoi(nhanVien.hoNhanVien);
                    nhanVien.soDienThoai = nhanVien.soDienThoai.Trim();
                    nhanVien.cMND        = nhanVien.cMND.Trim();
                    nhanVien.thuongTru   = CServices.formatChuoi(nhanVien.thuongTru);
                    nhanVien.tamTru      = CServices.formatChuoi(nhanVien.tamTru);

                    quanLyQuanCoffee.NhanViens.Add(nhanVien);
                    quanLyQuanCoffee.SaveChanges();
                    return(true);
                }
                catch (DbUpdateException)
                {
                    MessageBox.Show("Lỗi! Không thể thêm dữ liệu");
                    return(false);
                }
                catch (DbEntityValidationException)
                {
                    MessageBox.Show("Lỗi! Kiểu dữ liệu được truyền vào không hợp lệ");
                    return(false);
                }
            }
            return(false);
        }
 private void btnBoChon_Click(object sender, RoutedEventArgs e)
 {
     hienThiThongTin(new LoaiNhanVien());
     isEnabledThongTin(false);
     loaiNhanVienSelect     = null;
     txtMaLoaiNhanVien.Text = CServices.taoMa <LoaiNhanVien>(CLoaiNhanVien_BUS.toList());
 }
 public frmThongTinNguyenLieu(NguyenLieu nguyenLieu = null, int flag = 1)
 {
     InitializeComponent();
     hienThi();
     // khi người dùng nhấn thêm thì ấn nút sửa đi
     if (flag == 1)
     {
         txtMaNguyenLieu.Text = CServices.taoMa <NguyenLieu>(CNguyenLieu_BUS.toList());
         btnSua.IsEnabled     = false;
         btnLuu.IsEnabled     = false;
     }
     // khi người dùng nhấn nút sửa
     else if (flag == 2)
     {
         btnThem.IsEnabled = false;
         btnSua.IsEnabled  = false;
     }
     // là khi người dùng bấm nút xem chi tiết
     else
     {
         btnThem.IsEnabled = false;
         btnLuu.IsEnabled  = false;
         isEnabledThongTin(false);
     }
     if (nguyenLieu != null)
     {
         NguyenLieuSelect = nguyenLieu;
         hienThiThongTin(NguyenLieuSelect);
     }
 }
 public frmThongTinNhanVien(NhanVien nhanVien = null, int flag = 1)
 {
     InitializeComponent();
     cmbLoaiNhanVien.ItemsSource = CLoaiNhanVien_BUS.toListTenLoai();
     dateNgayVaoLam.SelectedDate = DateTime.Now;
     // khi người dùng nhấn thêm thì ấn nút sửa
     if (flag == 1)
     {
         txtMaNhanVien.Text = CServices.taoMa <NhanVien>(CNhanVien_BUS.toListAll());
         btnSua.IsEnabled   = false;
         btnLuu.IsEnabled   = false;
     }
     // khi người dùng nhấn nút sửa
     else if (flag == 2)
     {
         btnThem.IsEnabled = false;
         btnSua.IsEnabled  = false;
     }
     // là khi người dùng bấm nút xem chi tiết
     else
     {
         btnThem.IsEnabled   = false;
         btnLuu.IsEnabled    = false;
         btnChosse.IsEnabled = false;
         isEnabledThongTin(false);
     }
     if (nhanVien != null)
     {
         nhanVienSelect = nhanVien;
         hienThiThongTin(nhanVienSelect);
     }
 }
        private void btnThem_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                LoaiNhanVien loaiNhanVien = new LoaiNhanVien();
                loaiNhanVien.maLoaiNhanvien = txtMaLoaiNhanVien.Text;
                loaiNhanVien.tenLoai        = txtTenLoai.Text;

                if (CLoaiNhanVien_BUS.add(loaiNhanVien))
                {
                    MessageBox.Show("Thêm thành công");
                    hienThiDSLoaiNhanVien(CLoaiNhanVien_BUS.toList());

                    txtMaLoaiNhanVien.Text = CServices.taoMa <LoaiNhanVien>(CLoaiNhanVien_BUS.toList());
                    txtTenLoai.Text        = "";
                }
            }
            catch (ArgumentNullException)
            {
                MessageBox.Show("Lỗi! Dữ liệu rống");
            }
            catch (FormatException)
            {
                MessageBox.Show("Lỗi! Dữ liệu không hợp lệ, Lương cơ bản phải là số");
            }
            catch (OverflowException)
            {
                MessageBox.Show("Lỗi! Độ dài quá giới hạn cho phép");
            }
        }
Ejemplo n.º 7
0
 public static Boolean add(HoaDon hoaDon)
 {
     if (CServices.kiemTraThongTin(hoaDon))
     {
         try
         {
             quanLyQuanCoffee.HoaDons.Add(hoaDon);
             quanLyQuanCoffee.SaveChanges();
         }
         catch (DbUpdateException)
         {
             MessageBox.Show("Lỗi! không thể lưu dữ liệu");
             return(false);
         }
         catch (DbEntityValidationException)
         {
             MessageBox.Show("Lỗi! không thể lưu dữ liệu");
             return(false);
         }
     }
     else
     {
         MessageBox.Show("Xem lại đơn giá");
     }
     return(true);
 }
Ejemplo n.º 8
0
        public static bool add(SanPham sanPham)
        {
            if (CServices.kiemTraThongTin(sanPham))
            {
                try
                {
                    sanPham.tenSanPham = CServices.formatChuoi(sanPham.tenSanPham);

                    quanLyQuanCoffee.SanPhams.Add(sanPham);
                    quanLyQuanCoffee.SaveChanges();
                }
                catch (DbUpdateException)
                {
                    MessageBox.Show("Lỗi! không thể lưu dữ liệu");
                    return(false);
                }
                catch (DbEntityValidationException)
                {
                    MessageBox.Show("Lỗi! kiểu dữ liệu");
                    return(false);
                }
            }
            else
            {
                MessageBox.Show("Xem lại đơn giá");
            }
            return(true);
        }
Ejemplo n.º 9
0
        public static bool edit(NguyenLieu nguyenLieu)
        {
            NguyenLieu temp = find(nguyenLieu.maNguyenLieu);

            if (temp == null || !CServices.kiemTraThongTin(nguyenLieu))
            {
                return(false);
            }

            try
            {
                temp.maNguyenLieu     = nguyenLieu.maNguyenLieu;
                temp.tenNguyenLieu    = CServices.formatChuoi(nguyenLieu.tenNguyenLieu);
                temp.maLoaiNguyenLieu = nguyenLieu.maLoaiNguyenLieu;
                temp.trangThai        = nguyenLieu.trangThai;

                quanLyQuanCoffee.SaveChanges();
            }
            catch (DbUpdateException)
            {
                MessageBox.Show("Lỗi! không thể sửa thông tin nguyên liệu");
                return(false);
            }
            return(true);
        }
Ejemplo n.º 10
0
        public static List <NguyenLieu> findTenLoai(string tenLoai)
        {
            tenLoai = CServices.formatChuoi(tenLoai);
            List <NguyenLieu> list = quanLyQuanCoffee.NguyenLieux
                                     .Where(x => x.LoaiNguyenLieu.tenLoaiNguyenLieu.Contains(tenLoai) && x.trangThai == 0).ToList();

            return(list == null ? new List <NguyenLieu>() : list);
        }
Ejemplo n.º 11
0
 public static bool  add(ChiTietHoaDon chiTietHoaDon)
 {
     if (CServices.kiemTraThongTin(chiTietHoaDon))
     {
         quanLyQuanCoffee.ChiTietHoaDons.Add(chiTietHoaDon);
     }
     return(true);
 }
 public frmQuanLyLoaiNguyenLieu()
 {
     InitializeComponent();
     txtMaLoaiNguyenLieu.Text = CServices.taoMa <LoaiNguyenLieu>(CLoaiNguyenLieu_BUS.toListAll());
     loaiNguyenLieuSeclect    = new LoaiNguyenLieu();
     hienThiDSLoaiNhanVien(CLoaiNguyenLieu_BUS.toList());
     isEnabledThongTin(false);
 }
Ejemplo n.º 13
0
 public frmQuanLySanPham()
 {
     InitializeComponent();
     hienthiSP();
     hienThiDSNguyenLieu();
     txtMasanpham.Text    = CServices.taoMa <SanPham>(CSanPham_BUS.DsSanPham());
     nguyenLieuThanhPhans = new List <NguyenLieu>();
 }
 public frmQuanLyLoaiNhanVien()
 {
     InitializeComponent();
     loaiNhanVienSelect = new LoaiNhanVien();
     hienThiDSLoaiNhanVien(CLoaiNhanVien_BUS.toList());
     isEnabledThongTin(false);
     txtMaLoaiNhanVien.Text = CServices.taoMa <LoaiNhanVien>(CLoaiNhanVien_BUS.toList());
 }
Ejemplo n.º 15
0
 private void btnBochon_Click(object sender, RoutedEventArgs e)
 {
     txtMasanpham.Text    = CServices.taoMa <SanPham>(CSanPham_BUS.DsSanPham());
     txtDonvitinh.Text    = null;
     cboLoaisanpham.Text  = null;
     txtTensanpham.Text   = "";
     txtDongia.Text       = "";
     sanPhamSelect        = null;
     nguyenLieuThanhPhans = new List <NguyenLieu>();
     hienThiDSNguyenLieuDuocChon();
 }
Ejemplo n.º 16
0
 public void load()
 {
     txtMasanpham.Text    = CServices.taoMa <SanPham>(CSanPham_BUS.DsSanPham());
     txtDonvitinh.Text    = null;
     cboLoaisanpham.Text  = null;
     txtTensanpham.Text   = "";
     txtDongia.Text       = "";
     sanPhamSelect        = null;
     nguyenLieuThanhPhans = new List <NguyenLieu>();
     hienThiDSNguyenLieuDuocChon();
 }
Ejemplo n.º 17
0
 public static bool add(LoaiNhanVien loaiNhanVien)
 {
     loaiNhanVien.tenLoai = CServices.formatChuoi(loaiNhanVien.tenLoai);
     try
     {
         quanLyQuanCoffee.LoaiNhanViens.Add(loaiNhanVien);
         quanLyQuanCoffee.SaveChanges();
         return(true);
     }
     catch (DbUpdateException)
     {
         MessageBox.Show("Lỗi! Không thể thêm dữ liệu");
         return(false);
     }
 }
        public frmThongTinPhieuNhap(NhanVien nhanVien = null, PhieuNhapNguyenLieu phieuNhapNguyenLieu = null, int flag = 1)
        {
            InitializeComponent();
            nhanVienSelect     = nhanVien;
            chiTietNguyenLieus = CChiTietNguyenLieu_BUS.toList();
            list1 = CChiTietPhieuNhapNguyenLieu_BUS.toListAll();
            phieuNhapNguyenLieuSelect = phieuNhapNguyenLieu;
            chiTietPhieuNhaps         = new List <ChiTietPhieuNhap>();

            donViTinhs = new List <string>();

            if (nhanVienSelect == null)
            {
                nhanVienSelect = new NhanVien();
            }
            if (phieuNhapNguyenLieuSelect == null)
            {
                phieuNhapNguyenLieuSelect = new PhieuNhapNguyenLieu();
            }

            txtMaPhieuNhap.Text = CServices.taoMa <PhieuNhapNguyenLieu>(CPhieuNhapNguyenLieu_BUS.toListAll());
            donViTinhs.Add("Kg");
            donViTinhs.Add("Gam");
            donViTinhs.Add("Lon");
            donViTinhs.Add("Chai");
            donViTinhs.Add("Trái");
            donViTinhs.Add("Lít");
            cmbDonViTinh.ItemsSource = donViTinhs;


            if (flag == 1)
            {
                btnSua.IsEnabled = false;
                btnXoa.IsEnabled = false;
                flat             = 1;
            }
            // là khi người dùng bấm nút xem chi tiết
            else
            {
                btnThem.IsEnabled         = false;
                btnSua.IsEnabled          = false;
                btnXoa.IsEnabled          = false;
                btnTaoPhieuNhap.IsEnabled = false;
                flat = 0;
                isEnabledThongTin(false);
            }
            hienThiThongTin(phieuNhapNguyenLieuSelect);
        }
        private void btnSua_Click(object sender, RoutedEventArgs e)
        {
            LoaiNguyenLieu loaiNguyenLieu = new LoaiNguyenLieu();

            loaiNguyenLieu.maLoaiNguyenLieu  = txtMaLoaiNguyenLieu.Text;
            loaiNguyenLieu.tenLoaiNguyenLieu = txtTenLoai.Text;
            loaiNguyenLieu.trangThai         = 0;

            if (CLoaiNguyenLieu_BUS.edit(loaiNguyenLieu))
            {
                MessageBox.Show("Sửa thành công");
                hienThiDSLoaiNhanVien(CLoaiNguyenLieu_BUS.toList());
                txtMaLoaiNguyenLieu.Text = CServices.taoMa <LoaiNguyenLieu>(CLoaiNguyenLieu_BUS.toListAll());
                txtTenLoai.Text          = "";
            }
        }
        private void btnChonNL_Click(object sender, RoutedEventArgs e)
        {
            if (dgChiTietNguyenLieu.SelectedItem == null)
            {
                MessageBox.Show("Bạn chưa chọn chi tiết Nguyên Liệu cần xuất");
                return;
            }

            int index = dgChiTietNguyenLieu.SelectedIndex;

            chiTietPhieuNhapselect = new ChiTietPhieuNhap();
            chiTietPhieuNhapselect = chiTietPhieuNhaps[index] as ChiTietPhieuNhap;
            if (chiTietPhieuNhapselect == null)
            {
                MessageBox.Show("Không có chi tiết phiếu nhập");
            }
            else
            {
                ChiTietPhieuXuat chitietPhieuXuat = new ChiTietPhieuXuat();
                if (i == 0)
                {
                    chitietPhieuXuat.maChiTietPhieuXuat = taoMaChiTietPX();
                    i = 1;
                }
                else
                {
                    chitietPhieuXuat.maChiTietPhieuXuat = CServices.taoMa <ChiTietPhieuXuat>(chiTietPhieuXuats);
                }
                chitietPhieuXuat.maChitietNguyenLieu = chiTietPhieuNhapselect.maChitietNguyenLieu;
                chitietPhieuXuat.soLuong             = chiTietPhieuNhapselect.soLuong;
                chitietPhieuXuat.donGia            = chiTietPhieuNhapselect.donGia;
                chitietPhieuXuat.thanhTien         = chiTietPhieuNhapselect.thanhTien;
                chitietPhieuXuat.maPhieuXuat       = txtMaPhieuXuat.Text;
                chitietPhieuXuat.ChiTietNguyenLieu = chiTietPhieuNhapselect.ChiTietNguyenLieu;
                chiTietPhieuXuats.Add(chitietPhieuXuat);
                dgChitietPhieuXuat.ItemsSource = chiTietPhieuXuats.Select(x => new
                {
                    maChiTietPhieuXuat = x.maChitietNguyenLieu.Substring(0, 13),
                    tenNguyenLieu      = x.ChiTietNguyenLieu.NguyenLieu.tenNguyenLieu.Trim(),
                    soLuong            = x.soLuong,
                    donGia             = x.donGia,
                    thanhTien          = x.thanhTien
                });
                txtBoxTongtien.Text = tinhTongThanhTien(chiTietPhieuXuats).ToString();
            }
        }
 private void btnXoa_Click(object sender, RoutedEventArgs e)
 {
     if (loaiNguyenLieuSeclect != null)
     {
         if (CLoaiNguyenLieu_BUS.remove(loaiNguyenLieuSeclect))
         {
             MessageBox.Show("Xóa thành công");
             hienThiDSLoaiNhanVien(CLoaiNguyenLieu_BUS.toList());
             txtMaLoaiNguyenLieu.Text = CServices.taoMa <LoaiNguyenLieu>(CLoaiNguyenLieu_BUS.toListAll());
             txtTenLoai.Text          = "";
         }
     }
     else
     {
         MessageBox.Show("Vui lòng chọn nguyên liệu cần xóa");
     }
 }
        private void btnTaoThongKe_Click(object sender, RoutedEventArgs e)
        {
            if (chiTietThongKes.Count() > 0)
            {
                double tongThanTien = 0;
                string maThongKe    = CServices.taoMa <ThongKe>(CThongKe.toList());

                foreach (var item in chiTietThongKes)
                {
                    tongThanTien += item.Item6;
                }

                ThongKe thongKe = new ThongKe();
                thongKe.maThongKe     = maThongKe;
                thongKe.ngayLap       = DateTime.Now;
                thongKe.tongThanhTien = tongThanTien;

                if (!CThongKe.add(thongKe))
                {
                    return;
                }

                foreach (var chiTiet in chiTietThongKes)
                {
                    ChiTietThongKe chiTietThongKe = new ChiTietThongKe();
                    chiTietThongKe.maChiTietThongKe = CServices.taoMa <ChiTietThongKe>(CChiTietThongKe.toList());
                    chiTietThongKe.maThongKe        = maThongKe;
                    chiTietThongKe.maNhanVien       = chiTiet.Item1;
                    chiTietThongKe.soLuongHoaDon    = chiTiet.Item4;
                    chiTietThongKe.soLuongBan       = chiTiet.Item5;
                    chiTietThongKe.ngayLap          = DateTime.Now;
                    chiTietThongKe.thanhTien        = chiTiet.Item6;
                    if (!CChiTietThongKe.add(chiTietThongKe))
                    {
                        return;
                    }
                }
                this.Close();
            }
            else
            {
                MessageBox.Show("Danh sách chi tiết thống kê rỗng, không thể tạo thống kê");
            }
        }
        private void btnXoa_Click(object sender, RoutedEventArgs e)
        {
            if (loaiNhanVienSelect != null)
            {
                if (CLoaiNhanVien_BUS.remove(loaiNhanVienSelect))
                {
                    MessageBox.Show("Xóa thành công");
                    hienThiDSLoaiNhanVien(CLoaiNhanVien_BUS.toList());
                    loaiNhanVienSelect = null;

                    txtTenLoai.Text        = "";
                    txtMaLoaiNhanVien.Text = CServices.taoMa <LoaiNhanVien>(CLoaiNhanVien_BUS.toList());
                }
            }
            else
            {
                MessageBox.Show("Vui lòng chọn nhân viên cần xóa");
            }
        }
Ejemplo n.º 24
0
 private void btnXacNhan_Click(object sender, RoutedEventArgs e)
 {
     if (CServices.kiemTraMatKhau(txtMatKhauMoi.Password))
     {
         string matKhau = CTaiKhoan_BUS.Encrypt(txtMatKhauCu.Password);
         if (taiKhoanSelect.matKhau == matKhau)
         {
             if (CTaiKhoan_BUS.doiMatKhau(taiKhoanSelect, txtMatKhauMoi.Password))
             {
                 MessageBox.Show("Thay đổi mật khẩu thành công");
                 this.Close();
             }
         }
         else
         {
             MessageBox.Show("Mật khẩu cũ không đúng. Vui lòng nhập lại");
         }
     }
 }
        private void btnTaoPhieuNhap_Click(object sender, RoutedEventArgs e)
        {
            if (chiTietPhieuNhaps.Count == 0)
            {
                MessageBox.Show("Điền thông tin phiếu nhập");
                return;
            }

            foreach (ChiTietPhieuNhap chiTietPhieuNhap in chiTietPhieuNhaps)
            {
                if (!CServices.kiemTraThongTin(chiTietPhieuNhap))
                {
                    return;
                }
            }
            try
            {
                PhieuNhapNguyenLieu phieuNhapNguyenLieu = new PhieuNhapNguyenLieu();
                phieuNhapNguyenLieu.maPhieuNhap       = txtMaPhieuNhap.Text;
                phieuNhapNguyenLieu.maNhanVien        = nhanVienSelect.maNhanVien;
                phieuNhapNguyenLieu.ngayNhap          = dateNgayNhap.SelectedDate.Value;
                phieuNhapNguyenLieu.tongThanhTien     = double.Parse(txtTongThanhTien.Text);
                phieuNhapNguyenLieu.trangThai         = 0;
                phieuNhapNguyenLieu.ChiTietPhieuNhaps = chiTietPhieuNhaps;
                if (CPhieuNhapNguyenLieu_BUS.add(phieuNhapNguyenLieu))
                {
                    MessageBox.Show("Thêm phiếu nhập thành công");
                    this.Close();
                }
            }
            catch (ArgumentNullException)
            {
                MessageBox.Show("Dữ liệu không được để rỗng");
            }
            catch (FormatException)
            {
                MessageBox.Show("Dữ liệu phải là số");
            }
            catch (OverflowException)
            {
                MessageBox.Show("Dữ liệu có độ lớn vượt quá giới hạn cho phép");
            }
        }
Ejemplo n.º 26
0
        public void HienThiDSLoaiSanPham()
        {
            List <LoaiSanPham> list = CLoaiSanPham_BUS.toList();

            if (list.Count > 0)
            {
                dgLoaisanpham.ItemsSource = list.Select(x => new
                {
                    maLoaiSanPham = x.maLoaiSanPham,
                    tenLoai       = x.tenLoai,
                    trangThai     = x.trangThai == 0 ? "Mở" : "Khóa"
                });
            }
            else
            {
                MessageBox.Show("Danh sách loại sản phẩm rỗng, chưa có loại sản phẩm nào");
            }
            txtmaLoai.Text = CServices.taoMa <LoaiSanPham>(CLoaiSanPham_BUS.toList());
        }
Ejemplo n.º 27
0
        public static NguyenLieu findNguyenLieuByTen(string tenNguyenLieu)
        {
            tenNguyenLieu = CServices.formatChuoi(tenNguyenLieu);
            //NguyenLieu nguyenLieu = quanLyQuanCoffee.NguyenLieux
            //    .Where(x => x.tenNguyenLieu.Contains(tenNguyenLieu) && x.trangThai == 0)
            //    .FirstOrDefault();
            NguyenLieu nguyenLieu = new NguyenLieu();

            foreach (NguyenLieu item in quanLyQuanCoffee.NguyenLieux.ToList())
            {
                if (item.tenNguyenLieu.ToLower().Trim() == tenNguyenLieu.ToLower().Trim() &&
                    item.trangThai == 0)
                {
                    nguyenLieu = item;
                    break;
                }
            }

            return(nguyenLieu);
        }
Ejemplo n.º 28
0
 private void dgLoaisanpham_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     try
     {
         if (dgLoaisanpham.SelectedItem != null)
         {
             a = CLoaiSanPham_BUS.find(dgLoaisanpham.SelectedValue.ToString());
             txtmaLoai.Text  = a.maLoaiSanPham;
             txttenLoai.Text = a.tenLoai;
         }
         else
         {
             txtmaLoai.Text  = CServices.taoMa <LoaiSanPham>(CLoaiSanPham_BUS.DSLoaiSP());
             txttenLoai.Text = "";
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Có lỗi: " + ex.Message);
     }
 }
        public static bool edit(PhieuNhapNguyenLieu phieuNhapNguyenLieu)
        {
            PhieuNhapNguyenLieu temp = find(phieuNhapNguyenLieu.maPhieuNhap);

            if (temp == null)
            {
                MessageBox.Show("Không tìm thấy phiếu nhập nguyên liệu để sửa thông tin");
                return(false);
            }
            if (!CServices.kiemTraThongTin(phieuNhapNguyenLieu))
            {
                MessageBox.Show("Thông tin không hợp lệ");
                return(false);
            }
            temp.maPhieuNhap   = phieuNhapNguyenLieu.maPhieuNhap;
            temp.maNhanVien    = phieuNhapNguyenLieu.maNhanVien;
            temp.ngayNhap      = phieuNhapNguyenLieu.ngayNhap;
            temp.tongThanhTien = phieuNhapNguyenLieu.tongThanhTien;
            quanLyQuanCoffee.SaveChanges();
            return(true);
        }
Ejemplo n.º 30
0
        public static bool edit(LoaiNhanVien loaiNhanVien)
        {
            LoaiNhanVien temp = find(loaiNhanVien.maLoaiNhanvien);

            if (temp == null)
            {
                return(false);
            }
            try
            {
                temp.maLoaiNhanvien = loaiNhanVien.maLoaiNhanvien;
                temp.tenLoai        = CServices.formatChuoi(loaiNhanVien.tenLoai);
                quanLyQuanCoffee.SaveChanges();
            }
            catch (DbUpdateException)
            {
                MessageBox.Show("Lỗi! không thể sửa thông tin loại nhân viên");
                return(false);
            }
            return(true);
        }