コード例 #1
0
        public NHANVIEN Get1NhanVien(int id)
        {
            var db    = new QLNV1Entities();
            var staff = db.NHANVIENs.Find(id);

            return(staff);
        }
コード例 #2
0
        public void DeleteStaff(int id)
        {
            var db    = new QLNV1Entities();
            var staff = db.NHANVIENs.Find(id);

            db.NHANVIENs.Remove(staff);
            db.SaveChanges();
        }
コード例 #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();
        }
コード例 #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();
        }
コード例 #5
0
        public SalaryStaff[] GetSalary()
        {
            var db = new QLNV1Entities();

            return(db.SalaryStaffs.ToArray());
        }
コード例 #6
0
        public PHONGBAN[] GetRoom()
        {
            var db = new QLNV1Entities();

            return(db.PHONGBANs.ToArray());
        }
コード例 #7
0
        public NHANVIEN[] GetNhanVien()
        {
            var db = new QLNV1Entities();

            return(db.NHANVIENs.ToArray());
        }
コード例 #8
0
        void txtFind_TextChanged(object sender, EventArgs e)
        {
            var db = new QLNV1Entities();

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

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