Exemplo n.º 1
0
        public void Delete_Staff(int id)
        {
            QLCH_Model db = new QLCH_Model();

            id = db.NhanViens.Where(p => p.id == id).Select(p => p.id).FirstOrDefault();
            foreach (NhanVien i in db.NhanViens)
            {
                if (i.id == id)
                {
                    db.NhanViens.Remove(i);
                }
            }
            db.SaveChanges();
        }
Exemplo n.º 2
0
        public void Add_Staff(string name, string gender, DateTime dob, string cmnd, string quequan, string diachi, string email, string phone)
        {
            QLCH_Model DB = new QLCH_Model();
            NhanVien   n  = new NhanVien
            {
                Name    = name,
                Gender  = gender,
                DOB     = dob,
                CMND    = cmnd,
                QueQuan = quequan,
                DiaChi  = diachi,
                Email   = email,
                Phone   = phone
            };

            DB.NhanViens.Add(n);
            DB.SaveChanges();
        }
Exemplo n.º 3
0
        public void Edit_Staff(int id, string name, string gender, DateTime dob, string cmnd, string quequan, string diachi, string email, string phone, string pass)
        {
            QLCH_Model db = new QLCH_Model();
            NhanVien   nv = db.NhanViens.Where(p => p.id == id).FirstOrDefault();

            nv.Name    = name;
            nv.Gender  = gender;
            nv.DOB     = dob;
            nv.CMND    = cmnd;
            nv.QueQuan = quequan;
            nv.DiaChi  = diachi;
            nv.Email   = email;
            nv.Phone   = phone;
            if (pass != "")
            {
                Account ac = db.Accounts.Where(p => p.idNhanVien == id).FirstOrDefault();
                ac.PassWord = pass;
            }
            db.SaveChanges();
        }