public void Delete(string quyen) { datacontext = new VBDQDataContext(); PHANQUYEN p = datacontext.PHANQUYENs.Where(m => m.QUYEN == quyen).FirstOrDefault(); if (p != null) { datacontext.PHANQUYENs.DeleteOnSubmit(p); } datacontext.SubmitChanges(); }
public void Delete(string username) { datacontext = new VBDQDataContext(); if (username == "super") { return; // không cho xóa trùm cuối } NGUOIDUNG p = datacontext.NGUOIDUNGs.Where(m => m.USERNAME == username).FirstOrDefault(); if (p != null) { datacontext.NGUOIDUNGs.DeleteOnSubmit(p); } datacontext.SubmitChanges(); }
public void Update(PhanQuyen_DTO x) { datacontext = new VBDQDataContext(); PHANQUYEN p = datacontext.PHANQUYENs.Where(m => m.QUYEN == x.Quyen).FirstOrDefault(); if (p != null) { p.PHIEUMUA = x.PhieuMua; p.PHIEUBAN = x.PhieuBan; p.DICHVU = x.DichVu; p.QUANLY = x.QuanLy; p.THUKHO = x.ThuKho; } datacontext.SubmitChanges(); }
public void Update(NguoiDung_DTO x) { datacontext = new VBDQDataContext(); if (x.UserName == "super") { return; // không cho sửa trùm cuối } NGUOIDUNG p = datacontext.NGUOIDUNGs.Where(m => m.USERNAME == x.UserName).FirstOrDefault(); if (p != null) { p.PASS = x.Pass; p.QUYEN = x.Quyen; } datacontext.SubmitChanges(); }
public NguoiDung_DTO Get(string username) { datacontext = new VBDQDataContext(); NGUOIDUNG x = datacontext.NGUOIDUNGs.Where(m => m.USERNAME.CompareTo(username) == 0).FirstOrDefault(); if (x != null) // có username, ss pass. { return(new NguoiDung_DTO() { Quyen = x.QUYEN, Pass = x.PASS, UserName = x.USERNAME }); } else { return(null); // không tìm thấy } }
public List <CTBaoCao_DTO> LayCTBaoCao(int a) { vbdq = new VBDQDataContext(); BAOCAOTONKHO bctk = new BAOCAOTONKHO(); var MyQuery = (from bc in vbdq.CTBAOCAOs join tk in vbdq.BAOCAOTONKHOs on bc.MaBaoCao equals tk.MaBaoCao where bc.MaBaoCao == a select new CTBaoCao_DTO { MaBaoCao = bc.MaBaoCao, MaSP = bc.MaSP, TonDau = (int)bc.TonDau, SLMua = (int)bc.SLMua, SLBan = (int)bc.SLBan, TonCuoi = (int)bc.TonCuoi, NgayLap = tk.NgayLap.ToString() }); return(MyQuery.ToList()); }
public void ThemChiTietMua(CTPhieuMua_DTO a) { DB = new VBDQDataContext(); CTPHIEUMUA b = new CTPHIEUMUA(); b.SoPhieuMua = a.SoPhieuMua; b.STT = this.LayKhoaMoi(b.SoPhieuMua) + 1; b.MaSP = a.MaSP; b.DonGia = a.DonGia; b.SoLuong = a.SoLuong; b.ThanhTien = a.ThanhTien; DB.CTPHIEUMUAs.InsertOnSubmit(b); DB.SubmitChanges(); var obj = DB.PHIEUMUAHANGs.Single(x => x.SoPhieuMua == a.SoPhieuMua); //obj.TongTien = a.TongTien; obj.TongTien += b.ThanhTien; var c = DB.SANPHAMs.Single(x => x.MaSP == a.MaSP); c.SoLuongTon += a.SoLuong; DB.SubmitChanges(); }