Esempio n. 1
0
        public NHANVIEN Get1NhanVien(int id)
        {
            var db    = new QLNV1Entities();
            var staff = db.NHANVIENs.Find(id);

            return(staff);
        }
Esempio n. 2
0
        public void DeleteStaff(int id)
        {
            var db    = new QLNV1Entities();
            var staff = db.NHANVIENs.Find(id);

            db.NHANVIENs.Remove(staff);
            db.SaveChanges();
        }
Esempio n. 3
0
        public void UpdateStaff(int id, string name, string gender, DateTime dateofbirth, string phonenumber, string address, int room)
        {
            var db       = new QLNV1Entities();
            var oldStaff = db.NHANVIENs.Find(id);

            oldStaff.name            = name;
            oldStaff.gender          = gender;
            oldStaff.dateofbirth     = dateofbirth;
            oldStaff.phonenumber     = phonenumber;
            oldStaff.address         = address;
            oldStaff.room            = room;
            db.Entry(oldStaff).State = System.Data.Entity.EntityState.Modified;
            db.SaveChanges();
        }
Esempio n. 4
0
        public void CreateStaff(string name, string gender, DateTime dateofbirth, string phonenumber, string address, int room)
        {
            var db       = new QLNV1Entities();
            var newStaff = new NHANVIEN();

            newStaff.name        = name;
            newStaff.gender      = gender;
            newStaff.dateofbirth = dateofbirth;
            newStaff.phonenumber = phonenumber;
            newStaff.address     = address;
            newStaff.room        = room;
            db.NHANVIENs.Add(newStaff);
            db.SaveChanges();
        }
Esempio n. 5
0
        public SalaryStaff[] GetSalary()
        {
            var db = new QLNV1Entities();

            return(db.SalaryStaffs.ToArray());
        }
Esempio n. 6
0
        public PHONGBAN[] GetRoom()
        {
            var db = new QLNV1Entities();

            return(db.PHONGBANs.ToArray());
        }
Esempio n. 7
0
        public NHANVIEN[] GetNhanVien()
        {
            var db = new QLNV1Entities();

            return(db.NHANVIENs.ToArray());
        }
        void txtFind_TextChanged(object sender, EventArgs e)
        {
            var db = new QLNV1Entities();

            grdStaff.DataSource = db.NHANVIENs.Where(x => x.name.Contains(txtFind.Text)).ToList();
        }
        void btnSort_Click(object sender, EventArgs e)
        {
            var db = new QLNV1Entities();

            grdSalary.DataSource = db.SalaryStaffs.OrderBy(r => r.salary).ToList();
        }