示例#1
0
        public void DeleteStaff(int id)
        {
            var db     = new MyRoomEntities();
            var @class = db.STAFFs.Find(id);

            db.STAFFs.Remove(@class);
            db.SaveChanges();
        }
示例#2
0
        public void EditStaff(int ID, string CODE, string NAME, DateTime BIRTHDAY, string HOMETOWN, int ROOM_ID, int SALARY)
        {
            var db       = new MyRoomEntities();
            var oldClass = db.STAFFs.Find(ID);

            oldClass.CODE            = CODE;
            oldClass.NAME            = NAME;
            oldClass.BIRTHDAY        = BIRTHDAY;
            oldClass.HOMETOWN        = HOMETOWN;
            oldClass.ROOM_ID         = ROOM_ID;
            oldClass.SALARY          = SALARY;
            db.Entry(oldClass).State = System.Data.Entity.EntityState.Modified;
            db.SaveChanges();
        }
示例#3
0
        public void AddStaff(string CODE, string NAME, DateTime BIRTHDAY, string HOMETOWN, int ROOM_ID, int SALARY)
        {
            var newClass = new STAFF();

            newClass.CODE     = CODE;
            newClass.NAME     = NAME;
            newClass.BIRTHDAY = BIRTHDAY;
            newClass.HOMETOWN = HOMETOWN;
            newClass.ROOM_ID  = ROOM_ID;
            newClass.SALARY   = SALARY;

            var db = new MyRoomEntities();

            db.STAFFs.Add(newClass);
            db.SaveChanges();
        }
示例#4
0
        public STAFF[] getSort()
        {
            var db = new MyRoomEntities();

            return(db.STAFFs.ToArray());
        }
示例#5
0
        public STAFF GetStaff(int id)
        {
            var db = new MyRoomEntities();

            return(db.STAFFs.Find(id));
        }
示例#6
0
        public ROOM[] GetRooms()
        {
            var db = new MyRoomEntities();

            return(db.ROOMs.ToArray());
        }
示例#7
0
        public STAFF[] GetStaffs()
        {
            var db = new MyRoomEntities();

            return(db.STAFFs.ToArray());
        }