Beispiel #1
0
        public void Insert(string fname, string lname, string gender, DateTime dob, short age, string address,
                           string phone1, string phone2, string email, string position, int salary, DateTime workdate)
        {
            var insert = new Hospital_Entity_Framework.Worker()
            {
                FirstName = fname, LastName = lname, Gender = gender, DOB = dob, Age = age, Address = address,
                Phone1    = phone1, Phone2 = phone2, Email = email, Position = position, Salary = salary, StartWorkDate = workdate, Hire = true
            };

            _db.Workers.Add(insert);
            _db.SaveChanges();
        }
Beispiel #2
0
        public Hospital_Entity_Framework.Account Selection(Hospital_Entity_Framework.Worker worker)
        {
            var selection = from v in _db.Accounts
                            where v.WorkerId == worker.Id
                            select new
            {
                v.Id,
                v.WorkerId,
                v.UserName,
                v.Password
            };

            foreach (var item in selection)
            {
                var account = new Hospital_Entity_Framework.Account()
                {
                    Id = item.Id, WorkerId = item.WorkerId, UserName = item.UserName, Password = item.Password
                };
                return(account);
            }
            return(null);
        }