public KeHoach getKeHoach(string id) { QLNTEntities1 db = new QLNTEntities1(); int ma = Convert.ToInt32(id); return(db.KeHoach.Where(c => c.MaKeHoach == ma).SingleOrDefault()); }
public List <HangHoa> getListNongSan() { using (QLNTEntities1 db = new QLNTEntities1()) { var result = db.getListNongSan(); List <HangHoa> l = new List <HangHoa>(); foreach (var item in result) { HangHoa h = new HangHoa(); h.ten = item.TenNS; h.hanSD = item.HanSD.Value.ToString("dd/MM/yyyy"); h.SL = item.SanLuong; h.ma = item.MaNS; h.loai = "Nông sản"; string trangThai = "Còn hàng"; if (item.SanLuong == 0) { trangThai = "Hết hàng"; h.hanSD = "-"; } else if (item.SanLuong < 100) { trangThai = "Sắp hết hàng"; } if (DateTime.Compare(item.HanSD.Value, DateTime.Now) == -1 && item.SanLuong != 0) { trangThai = "Hết hạn sử dụng"; } h.tinhTrang = trangThai; l.Add(h); } return(l); } }
public void Add(NhanVien nv) { using (QLNTEntities1 db = new QLNTEntities1()) { db.NhanVien.Add(nv); db.SaveChanges(); } }
public void Add(NhaCungCap ncc) { using (QLNTEntities1 db = new QLNTEntities1()) { db.NhaCungCap.Add(ncc); db.SaveChanges(); } }
public void Delete(int maKH, int maLoai) { using (QLNTEntities1 db = new QLNTEntities1()) { ChiTietKH ct = db.ChiTietKH.Where(c => c.MaKH == maKH && c.MaLoai == maLoai).SingleOrDefault(); db.ChiTietKH.Remove(ct); db.SaveChanges(); } }
public void View(BunifuCustomDataGrid dataGid) { using (QLNTEntities1 db = new QLNTEntities1()) { var result = from c in db.NhaCungCap select new { TenNCC = c.TenNCC, SoDienThoai = c.SoDienThoai, DiaChi = c.DiaChi, MaNCC = c.MaNCC }; dataGid.DataSource = result.ToList(); } }
public void setHuySL(int id) { using (QLNTEntities1 db = new QLNTEntities1()) { PhanBon p = db.PhanBon.Where(c => c.MaPB == id).SingleOrDefault(); p.SoLuong = 0; db.SaveChanges(); } }
public void setHuySL(int id) { using (QLNTEntities1 db = new QLNTEntities1()) { NongSan p = db.NongSan.Where(c => c.MaNS == id).SingleOrDefault(); p.SanLuongTonKho = 0; db.SaveChanges(); } }
public void setHuySL(int id) { using (QLNTEntities1 db = new QLNTEntities1()) { ThuocBaoVeTV p = db.ThuocBaoVeTV.Where(c => c.MaThuoc == id).SingleOrDefault(); p.SoLuong = 0; db.SaveChanges(); } }
public void setSoLuongCongViec(int MaKH) { using (QLNTEntities1 db = new QLNTEntities1()) { KeHoach k = db.KeHoach.Find(MaKH); int count = (from c in db.ChiTietKH where c.MaKH == MaKH select c).Count(); k.SoLuongCongViec = count; db.SaveChanges(); } }
public void Search(BunifuCustomDataGrid dataGrid, string s) { using (QLNTEntities1 db = new QLNTEntities1()) { var result = from c in db.PhanBons where c.TenPB.Contains(s) select new { TenPB = c.TenPB, Loai = c.Loai, KhoiLuong = c.KhoiLuong.ToString(), SoLuong = c.SoLuong, DonGia = c.DonGia, NgaySX = c.NgaySX.Day + "/" + c.NgaySX.Month + "/" + c.NgaySX.Year, HanSD = c.HanSD.Day + "/" + c.HanSD.Month + "/" + c.HanSD.Year, MaPB = c.MaPB }; dataGrid.DataSource = result.ToList(); } }
public void Delete(string id) { using (QLNTEntities1 db = new QLNTEntities1()) { int ma = Convert.ToInt32(id); ThuocBaoVeTV temp = db.ThuocBaoVeTV.Where(p => p.MaThuoc == ma).SingleOrDefault(); db.ThuocBaoVeTV.Remove(temp); db.SaveChanges(); } }
public void View(BunifuCustomDataGrid dataGrid) { using (QLNTEntities1 db = new QLNTEntities1()) { //var result = from c in db.NongSans select new { TenPB=c.TenPB, Loai=c} ; var result = from c in db.NongSans select new { ThoiGianBaoQuan = c.ThoiGianBaoQuan, SanLuongTonKho = c.SanLuongTonKho, DonGia = c.DonGia, BaoQuan = c.BaoQuan }; dataGrid.DataSource = result.ToList(); } }
public void Delete(string id) { using (QLNTEntities1 db = new QLNTEntities1()) { int ma = Convert.ToInt32(id); NhaCungCap ncc = db.NhaCungCap.Where(p => p.MaNCC == ma).SingleOrDefault(); db.NhaCungCap.Remove(ncc); db.SaveChanges(); } }
public void Edit(int id, string noiDung, string chuThich) { using (QLNTEntities1 db = new QLNTEntities1()) { KeHoach temp = db.KeHoach.Find(id); temp.NoiDung = noiDung; temp.ChuThich = chuThich; db.SaveChanges(); } }
public void Delete(string id) { using (QLNTEntities1 db = new QLNTEntities1()) { int ma = Convert.ToInt32(id); KhachHang temp = db.KhachHang.Where(p => p.MaKH == ma).SingleOrDefault(); db.KhachHang.Remove(temp); db.SaveChanges(); } }
public void View(BunifuCustomDataGrid dataGid) { using (QLNTEntities1 db = new QLNTEntities1()) { //var result = from c in db.PhanBons select new { TenPB=c.TenPB, Loai=c} ; var result = from c in db.KhachHang select new { TenKH = c.TenKH, DienThoai = c.DienThoai, DiaChi = c.DiaChi, MaKH = c.MaKH }; dataGid.DataSource = result.ToList(); } }
public void Delete(string id) { using (QLNTEntities1 db = new QLNTEntities1()) { int ma = Convert.ToInt32(id); BangThuHoach temp = db.BangThuHoach.Where(p => p.MaBang == ma).SingleOrDefault(); db.BangThuHoach.Remove(temp); db.SaveChanges(); } }
public void Delete(string id) { using (QLNTEntities1 db = new QLNTEntities1()) { int ma = Convert.ToInt32(id); NongSan temp = db.NongSans.Where(p => p.MaNS == ma).SingleOrDefault(); db.NongSans.Remove(temp); db.SaveChanges(); } }
public void Search(BunifuCustomDataGrid dataGrid, string s) { using (QLNTEntities1 db = new QLNTEntities1()) { var result = from c in db.ThuocBaoVeTV where c.TenThuoc.Contains(s) select new { TenThuoc = c.TenThuoc, ThoiGianCachLy = c.ThoiGianCachLy, NoiSX = c.NoiSX, Dang = c.Dang, SoLuong = c.SoLuong, CongDung = c.CongDung, NgaySX = c.NgaySX, HanSD = c.HanSD, MaThuoc = c.MaThuoc, MaDoc = c.MaDoc }; dataGrid.DataSource = result.ToList(); } }
public void Search(BunifuCustomDataGrid dataGrid, string s) { using (QLNTEntities1 db = new QLNTEntities1()) { var result = from c in db.Cay where c.TenCay.Contains(s) select new { TenCay = c.TenCay, SoLuong = c.SoLuong, MuaThuHoach = c.MuaThuHoach, NamTrongCay = c.NamTrongCay, MaLoaiCay = c.MaLoaiCay }; dataGrid.DataSource = result.ToList(); } }
public void Delete(string id) { using (QLNTEntities1 db = new QLNTEntities1()) { int ma = Convert.ToInt32(id); Cay temp = db.Cay.Where(p => p.MaLoaiCay == ma).SingleOrDefault(); db.Cay.Remove(temp); db.SaveChanges(); } }
public void View(BunifuCustomDataGrid dataGrid) { using (QLNTEntities1 db = new QLNTEntities1()) { //var result = from c in db.PhanBons select new { TenPB=c.TenPB, Loai=c} ; var result = from c in db.Cay select new { TenCay = c.TenCay, SoLuong = c.SoLuong, MuaThuHoach = c.MuaThuHoach, NamTrongCay = c.NamTrongCay, MaLoaiCay = c.MaLoaiCay }; dataGrid.DataSource = result.ToList(); } }
public void Delete(string id) { using (QLNTEntities1 db = new QLNTEntities1()) { int ma = Convert.ToInt32(id); NhanVien nv = db.NhanVien.Where(p => p.MaNV == ma).SingleOrDefault(); db.NhanVien.Remove(nv); db.SaveChanges(); } }
public void getCTKeHoach(string id, BunifuCustomDataGrid dataGrid) { QLNTEntities1 db = new QLNTEntities1(); int ma = Convert.ToInt32(id); var result = from c in db.ChiTietKH join d in db.LoaiKH on c.MaLoai equals d.MaLoai where c.MaKH == ma select new { CongViec = d.TenLoai, HoanThanh = c.HoanThanh, MaLoai = c.MaLoai }; dataGrid.DataSource = result.ToList(); }
public void Edit(BangThuHoach o) { using (QLNTEntities1 db = new QLNTEntities1()) { int ma = o.MaBang; BangThuHoach temp = db.BangThuHoach.Find(ma); temp.NgayThuHoach = o.NgayThuHoach; temp.MaNV = o.MaNV; db.SaveChanges(); } }
public NhanVien getNhanVien(string id) { NhanVien nv; using (QLNTEntities1 db = new QLNTEntities1()) { int ma = Convert.ToInt32(id); nv = db.NhanVien.Where(p => p.MaNV == ma).SingleOrDefault(); } return(nv); }
public void View(BunifuCustomDataGrid dataGid) { using (QLNTEntities1 db = new QLNTEntities1()) { var result = from c in db.NhanVien join q in db.Quyen on c.MaQuyen equals q.MaQuyen where q.MaQuyen != 1 select new { TenNV = c.TenNV, SoDienThoai = c.SoDienThoai, DiaChi = c.DiaChi, MatKhau = c.MatKhau, MaNV = c.MaNV, TenChucVu = q.TenChucVu, MaQuyen = q.MaQuyen }; dataGid.DataSource = result.ToList(); } }
public void View(BunifuCustomDataGrid dataGrid) { using (QLNTEntities1 db = new QLNTEntities1()) { //var result = from c in db.PhanBons select new { TenPB=c.TenPB, Loai=c} ; var result = from c in db.ThuocBaoVeTV select new { TenThuoc = c.TenThuoc, ThoiGianCachLy = c.ThoiGianCachLy, NoiSX = c.NoiSX, Dang = c.Dang, SoLuong = c.SoLuong, CongDung = c.CongDung, NgaySX = c.NgaySX, HanSD = c.HanSD, MaThuoc = c.MaThuoc, MaDoc = c.MaDoc }; dataGrid.DataSource = result.ToList(); } }
public void setHoanThanh(ChiTietKH ct, bool value) { using (QLNTEntities1 db = new QLNTEntities1()) { int ma = ct.MaKH; ChiTietKH temp = db.ChiTietKH.Where(c => c.MaLoai == ct.MaLoai && c.MaKH == ct.MaKH).SingleOrDefault(); temp.HoanThanh = value; db.SaveChanges(); } }