public bool ThemLoaiGiamGia(ref string err, int MaGiam, string Ten, float Giam) { bool f = false; LoaiGiamGia hs = new LoaiGiamGia(); hs.MaLoaiGiamGia = MaGiam; hs.TenGiamGia = Ten; hs.Giam = Giam; try { dbs.LoaiGiamGias.InsertOnSubmit(hs); dbs.SubmitChanges(); f = true; } catch (Exception ex) { err = ex.Message; } return(f); }
public bool XoaLoaiGiamGia(ref string err, int MaGiamGia) { bool f = false; LoaiGiamGia hs = dbs.LoaiGiamGias.Single(p => p.MaLoaiGiamGia == MaGiamGia); try { if (hs != null) { dbs.LoaiGiamGias.DeleteOnSubmit(hs); dbs.SubmitChanges(); f = true; } } catch (Exception ex) { err = ex.Message; } return(f); }
public bool SuaLoaiGiamGia(ref string err, int MaGiamGia, string TenGiamGia, float Giam) { bool f = false; LoaiGiamGia d = dbs.LoaiGiamGias.Single(p => p.MaLoaiGiamGia == MaGiamGia); try { if (d != null) { d.TenGiamGia = TenGiamGia; d.Giam = Giam; dbs.SubmitChanges(); f = true; } } catch (Exception ex) { err = ex.Message; } return(f); }