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

            db.STAFFs.Remove(@class);
            db.SaveChanges();
        }
Exemple #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();
        }
Exemple #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();
        }
Exemple #4
0
        public STAFF[] getSort()
        {
            var db = new MyRoomEntities();

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

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

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

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