示例#1
0
        public void delete_LoaiHangHoa(string ma)
        {
            LoaiHangHoa hh = lhh.LoaiHangHoas.Where(t => t.maLoaiHH == ma).FirstOrDefault();

            lhh.LoaiHangHoas.DeleteOnSubmit(hh);
            lhh.SubmitChanges();
        }
示例#2
0
        public void SuaLoaiHangHoa(string ma, string ten)
        {
            LoaiHangHoa hh = lhh.LoaiHangHoas.Where(t => t.maLoaiHH == ma).FirstOrDefault();

            hh.maLoaiHH  = ma;
            hh.tenLoaiHH = ten;
            lhh.SubmitChanges();
        }
示例#3
0
        public void insert_LoaiHangHoa(string makh, string tekh)
        {
            LoaiHangHoa hh = new LoaiHangHoa();

            hh.maLoaiHH  = makh;
            hh.tenLoaiHH = tekh;

            lhh.LoaiHangHoas.InsertOnSubmit(hh);
            lhh.SubmitChanges();
        }
示例#4
0
        public string getMALOAILast()
        {
            List <LoaiHangHoa> a = lhh.LoaiHangHoas.ToList();

            if (a.Count == 0)// neu chua co nhan vien nao
            {
                return("");
            }
            //da co ma nhan vien
            LoaiHangHoa b = lhh.LoaiHangHoas.ToList().OrderByDescending(t => t.maLoaiHH).First();

            return(b.maLoaiHH);
        }
示例#5
0
 public bool delete(String id)
 {
     using (CellphoneComponentEntities db = new CellphoneComponentEntities())
     {
         LoaiHangHoa loaiHangHoa = (from item in db.LoaiHangHoas
                                    where item.MaLoaiHangHoa == id
                                    select item).SingleOrDefault();
         db.LoaiHangHoas.Remove(loaiHangHoa);
         if (db.SaveChanges() > 0)
         {
             return(true);
         }
         return(false);
     }
 }
示例#6
0
        public bool insert(DTO_LoaiHangHoa obj)
        {
            using (CellphoneComponentEntities db = new CellphoneComponentEntities())
            {
                LoaiHangHoa loaiHangHoa = new LoaiHangHoa();
                loaiHangHoa.MaLoaiHangHoa    = obj.MaLoaiHangHoa;
                loaiHangHoa.TenLoaiHangHoa   = obj.TenLoaiHangHoa;
                loaiHangHoa.PhanTramLoiNhuan = obj.PhanTramLoiNhuan;

                db.LoaiHangHoas.Add(loaiHangHoa);
                if (db.SaveChanges() > 0)
                {
                    return(true);
                }
                return(false);
            }
        }
示例#7
0
        public bool update(DTO_LoaiHangHoa obj)
        {
            using (CellphoneComponentEntities db = new CellphoneComponentEntities())
            {
                LoaiHangHoa loaiHangHoa = new LoaiHangHoa();
                loaiHangHoa.MaLoaiHangHoa    = obj.MaLoaiHangHoa;
                loaiHangHoa.TenLoaiHangHoa   = obj.TenLoaiHangHoa;
                loaiHangHoa.PhanTramLoiNhuan = obj.PhanTramLoiNhuan;

                db.LoaiHangHoas.Attach(loaiHangHoa);
                db.Entry(loaiHangHoa).State = System.Data.Entity.EntityState.Modified;
                if (db.SaveChanges() > 0)
                {
                    return(true);
                }
                return(false);
            }
        }