Example #1
0
        public int insertPc(ePhanCong pc)
        {
            List <ePhanCong> p = new List <ePhanCong>();
            var rpc            = (from a in db.PhanCongs
                                  select new ePhanCong
            {
                MAPB = a.MAPB,
                MACT = a.MACT,
                MANV = a.MANV,
                SLNGAYCONG = a.SLNGAYCONG,
            });

            p = rpc.ToList();
            foreach (ePhanCong e in p)
            {
                if (e.MANV == pc.MANV && e.MAPB == pc.MAPB && e.MACT == pc.MACT)
                {
                    return(0);
                }
            }
            PhanCong b = new PhanCong();

            b.MACT       = pc.MACT;
            b.MANV       = pc.MANV;
            b.MAPB       = pc.MAPB;
            b.SLNGAYCONG = pc.SLNGAYCONG;
            db.PhanCongs.InsertOnSubmit(b);
            db.SubmitChanges();
            return(1);
        }
Example #2
0
        public int remove1datafromPhanCong(ePhanCong pc)
        {
            var tmp = db.PhanCongs.Where(x => (x.MANV == pc.MANV && x.MAPB == pc.MAPB && x.MACT == pc.MACT)).FirstOrDefault();

            if (tmp == null)
            {
                return(0);
            }
            db.PhanCongs.DeleteOnSubmit(tmp);
            db.SubmitChanges();
            return(1);
        }
Example #3
0
        public int change1PhanCong(ePhanCong pc)
        {
            var tmp = db.PhanCongs.Where(x => (x.MANV == pc.MANV && x.MAPB == pc.MAPB && x.MACT == pc.MACT)).FirstOrDefault();

            if (tmp == null)
            {
                return(0);
            }
            db.PhanCongs.DeleteOnSubmit(tmp);
            PhanCong b = new PhanCong();

            b.MACT       = pc.MACT;
            b.MANV       = pc.MANV;
            b.MAPB       = pc.MAPB;
            b.SLNGAYCONG = pc.SLNGAYCONG;
            db.PhanCongs.InsertOnSubmit(b);
            db.SubmitChanges();
            return(1);
        }