Beispiel #1
0
        public int AddUser(int Id, string FirstName, string MiddleName, string LastName, DateTime BirthDate, string Gender, int?Weight, int?Height, string HomeAddress, Int64?HomePhone, string OfficeAddress, Int64 OfficePhone, string EmailAdd, Int64?CellphoneNumber, string Name, string Description)
        {
            TestDBEntities tstDb  = new TestDBEntities();
            Physician      usrdtl = new Physician();

            usrdtl.Id          = Id;
            usrdtl.FirstName   = FirstName;
            usrdtl.MiddleName  = MiddleName;
            usrdtl.LastName    = LastName;
            usrdtl.BirthDate   = BirthDate;
            usrdtl.Gender      = Gender;
            usrdtl.Weight      = Weight;
            usrdtl.Height      = Height;
            usrdtl.ContactInfo = new ContactInfo
            {
                Id              = Id,
                HomeAddress     = HomeAddress,
                HomePhone       = HomePhone,
                OfficeAddress   = OfficeAddress,
                OfficePhone     = OfficePhone,
                EmailAdd        = EmailAdd,
                CellphoneNumber = CellphoneNumber
            };
            usrdtl.Specialization = new Specialization
            {
                Id          = Id,
                Name        = Name,
                Description = Description
            };
            tstDb.Physicians.Add(usrdtl);
            int Retval = tstDb.SaveChanges();

            return(Retval);
        }
Beispiel #2
0
        public int DeleteUserById(int Id)
        {
            TestDBEntities tstDb  = new TestDBEntities();
            InfoUser       usrdtl = new InfoUser();

            usrdtl.ID = Id;
            tstDb.Entry(usrdtl).State = EntityState.Deleted;
            int Retval = tstDb.SaveChanges();

            return(Retval);
        }
Beispiel #3
0
        public int AddSpecialization(string Name, string Description)
        {
            TestDBEntities tstDb  = new TestDBEntities();
            Physician      usrdtl = new Physician();

            usrdtl.Specialization.Name        = Name;
            usrdtl.Specialization.Description = Description;
            tstDb.Physicians.Add(usrdtl);
            int Retval = tstDb.SaveChanges();

            return(Retval);
        }
Beispiel #4
0
        public int AddUser(string Name, string Email)
        {
            TestDBEntities tstDb  = new TestDBEntities();
            InfoUser       usrdtl = new InfoUser();

            usrdtl.Name  = Name;
            usrdtl.Email = Email;
            tstDb.InfoUsers.Add(usrdtl);
            int Retval = tstDb.SaveChanges();

            return(Retval);
        }
Beispiel #5
0
        public int AddUser(string Name, string Email)
        {
            TestDBEntities tstDb  = new TestDBEntities();
            UserDetail     usrdtl = new UserDetail();

            usrdtl.Name  = Name;
            usrdtl.Email = Email;
            tstDb.UserDetails.Add(usrdtl);
            int Retval = tstDb.SaveChanges();

            return(Retval);
        }
Beispiel #6
0
        public int UpdateUser(int Id, string Name, string Email)
        {
            TestDBEntities tstDb  = new TestDBEntities();
            UserDetail     usrdtl = new UserDetail();

            usrdtl.Id    = Id;
            usrdtl.Name  = Name;
            usrdtl.Email = Email;
            tstDb.Entry(usrdtl).State = EntityState.Modified;
            int Retval = tstDb.SaveChanges();

            return(Retval);
        }
Beispiel #7
0
        public UserDetail GetAllUserById(int id)
        {
            TestDBEntities tstDb  = new TestDBEntities();
            var            lstUsr = from k in tstDb.UserDetails where k.Id == id select k;
            UserDetail     usr    = new UserDetail();

            foreach (var item in lstUsr)
            {
                usr.Id    = item.Id;
                usr.Name  = item.Name;
                usr.Email = item.Email;
            }

            return(usr);
        }
Beispiel #8
0
        public InfoUser GetAllUserById(int id)
        {
            TestDBEntities tstDb  = new TestDBEntities();
            var            lstUsr = from k in tstDb.InfoUsers where k.ID == id select k;
            InfoUser       usr    = new InfoUser();

            foreach (var item in lstUsr)
            {
                usr.ID    = item.ID;
                usr.Name  = item.Name;
                usr.Email = item.Email;
            }

            return(usr);
        }
Beispiel #9
0
        public int AddContact(string HomeAddress, Int64 HomePhone, string OfficeAddress, Int64 OfficePhone, string EmailAdd, Int64 CellphoneNumber)
        {
            TestDBEntities tstDb  = new TestDBEntities();
            Physician      usrdtl = new Physician();

            usrdtl.ContactInfo.HomeAddress     = HomeAddress;
            usrdtl.ContactInfo.HomePhone       = HomePhone;
            usrdtl.ContactInfo.OfficeAddress   = OfficeAddress;
            usrdtl.ContactInfo.OfficePhone     = OfficePhone;
            usrdtl.ContactInfo.EmailAdd        = EmailAdd;
            usrdtl.ContactInfo.CellphoneNumber = CellphoneNumber;
            tstDb.Physicians.Add(usrdtl);
            int Retval = tstDb.SaveChanges();

            return(Retval);
        }
Beispiel #10
0
        public int DeleteUserById(int Id)
        {
            TestDBEntities tstDb  = new TestDBEntities();
            Specialization usrspc = new Specialization();
            ContactInfo    usrctn = new ContactInfo();
            Physician      usrdtl = new Physician();

            usrspc.Id = Id;
            usrctn.Id = Id;
            usrdtl.Id = Id;
            tstDb.Entry(usrspc).State = EntityState.Deleted;
            tstDb.Entry(usrctn).State = EntityState.Deleted;
            tstDb.Entry(usrdtl).State = EntityState.Deleted;
            int Retval = tstDb.SaveChanges();

            return(Retval);
        }
Beispiel #11
0
        public List <InfoUser> GetAllUser()
        {
            List <InfoUser> userlst = new List <InfoUser>();
            TestDBEntities  tstDb   = new TestDBEntities();
            var             lstUsr  = from k in tstDb.InfoUsers select k;

            foreach (var item in lstUsr)
            {
                InfoUser usr = new InfoUser();
                usr.ID    = item.ID;
                usr.Name  = item.Name;
                usr.Email = item.Email;
                userlst.Add(usr);
            }

            return(userlst);
        }
Beispiel #12
0
        public List <UserDetail> GetAllUser()
        {
            List <UserDetail> userlst = new List <UserDetail>();
            TestDBEntities    tstDb   = new TestDBEntities();
            var lstUsr = from k in tstDb.UserDetails select k;

            foreach (var item in lstUsr)
            {
                UserDetail usr = new UserDetail();
                usr.Id    = item.Id;
                usr.Name  = item.Name;
                usr.Email = item.Email;
                userlst.Add(usr);
            }

            return(userlst);
        }
Beispiel #13
0
        public List <Physician> GetAllSpecialization()
        {
            List <Physician> userlst = new List <Physician>();
            TestDBEntities   tstDb   = new TestDBEntities();
            var lstUsr = from k in tstDb.Physicians select k;

            foreach (var item in lstUsr)
            {
                Physician usr = new Physician();

                usr.Specialization.Name = item.Specialization.Description;
                usr.Specialization.Name = item.Specialization.Description;


                userlst.Add(usr);
            }

            return(userlst);
        }
Beispiel #14
0
        public List <Physician> GetAllContactInfo()
        {
            List <Physician> userlst = new List <Physician>();
            TestDBEntities   tstDb   = new TestDBEntities();
            var lstUsr = from k in tstDb.Physicians select k;

            foreach (var item in lstUsr)
            {
                Physician usr = new Physician();

                usr.ContactInfo.HomeAddress     = item.ContactInfo.HomeAddress;
                usr.ContactInfo.HomePhone       = item.ContactInfo.HomePhone;
                usr.ContactInfo.OfficeAddress   = item.ContactInfo.OfficeAddress;
                usr.ContactInfo.OfficePhone     = item.ContactInfo.OfficePhone;
                usr.ContactInfo.EmailAdd        = item.ContactInfo.EmailAdd;
                usr.ContactInfo.CellphoneNumber = item.ContactInfo.CellphoneNumber;

                userlst.Add(usr);
            }

            return(userlst);
        }
Beispiel #15
0
        public List <Physician> GetAllPersonalInfo()
        {
            List <Physician> userlst = new List <Physician>();
            TestDBEntities   tstDb   = new TestDBEntities();
            var lstUsr = from k in tstDb.Physicians select k;

            foreach (var item in lstUsr)
            {
                Physician usr = new Physician();
                usr.Id          = item.Id;
                usr.FirstName   = item.FirstName;
                usr.MiddleName  = item.MiddleName;
                usr.LastName    = item.LastName;
                usr.BirthDate   = item.BirthDate;
                usr.Gender      = item.Gender;
                usr.Weight      = item.Weight;
                usr.Height      = item.Height;
                usr.ContactInfo = new ContactInfo
                {
                    Id              = item.Id,
                    HomeAddress     = item.ContactInfo.HomeAddress,
                    HomePhone       = item.ContactInfo.HomePhone,
                    OfficeAddress   = item.ContactInfo.OfficeAddress,
                    OfficePhone     = item.ContactInfo.OfficePhone,
                    EmailAdd        = item.ContactInfo.EmailAdd,
                    CellphoneNumber = item.ContactInfo.CellphoneNumber,
                };
                usr.Specialization = new Specialization
                {
                    Id          = item.Id,
                    Name        = item.Specialization.Name,
                    Description = item.Specialization.Description,
                };

                userlst.Add(usr);
            }

            return(userlst);
        }
Beispiel #16
0
        public Physician GetAllUserById(int id)
        {
            TestDBEntities tstDb  = new TestDBEntities();
            var            lstUsr = from k in tstDb.Physicians where k.Id == id select k;
            Physician      usr    = new Physician();

            foreach (var item in lstUsr)
            {
                usr.Id         = item.Id;
                usr.FirstName  = item.FirstName;
                usr.MiddleName = item.MiddleName;
                usr.LastName   = item.LastName;
                usr.BirthDate  = item.BirthDate;
                usr.Gender     = item.Gender;
                usr.Weight     = item.Weight;
                usr.Height     = item.Height;

                usr.ContactInfo = new ContactInfo
                {
                    Id              = item.Id,
                    HomeAddress     = item.ContactInfo.HomeAddress,
                    HomePhone       = item.ContactInfo.HomePhone,
                    OfficeAddress   = item.ContactInfo.OfficeAddress,
                    OfficePhone     = item.ContactInfo.OfficePhone,
                    EmailAdd        = item.ContactInfo.EmailAdd,
                    CellphoneNumber = item.ContactInfo.CellphoneNumber
                };

                usr.Specialization = new Specialization
                {
                    Id          = item.Id,
                    Name        = item.Specialization.Name,
                    Description = item.Specialization.Description
                };
            }

            return(usr);
        }
Beispiel #17
0
        public int UpdateUser(int Id, string FirstName, string MiddleName, string LastName, DateTime BirthDate, string Gender, int?Weight, int?Height, string HomeAddress, Int64?HomePhone, string OfficeAddress, Int64 OfficePhone, string EmailAdd, Int64?CellphoneNumber, string Name, string Description)
        {
            TestDBEntities tstDb  = new TestDBEntities();
            Physician      usrdtl = new Physician();


            usrdtl.Id         = Id;
            usrdtl.FirstName  = FirstName;
            usrdtl.MiddleName = MiddleName;
            usrdtl.LastName   = LastName;
            usrdtl.BirthDate  = BirthDate;
            usrdtl.Gender     = Gender;
            usrdtl.Weight     = Weight;
            usrdtl.Height     = Height;
            ContactInfo usrctn = new ContactInfo();

            usrctn.Id              = Id;
            usrctn.HomeAddress     = HomeAddress;
            usrctn.HomePhone       = HomePhone;
            usrctn.OfficeAddress   = OfficeAddress;
            usrctn.OfficePhone     = OfficePhone;
            usrctn.EmailAdd        = EmailAdd;
            usrctn.CellphoneNumber = CellphoneNumber;
            Specialization usrspc = new Specialization();

            usrspc.Id          = Id;
            usrspc.Name        = Name;
            usrspc.Description = Description;

            tstDb.Entry(usrdtl).State = EntityState.Modified;
            tstDb.Entry(usrctn).State = EntityState.Modified;
            tstDb.Entry(usrspc).State = EntityState.Modified;
            int Retval = tstDb.SaveChanges();

            return(Retval);
        }