Example #1
0
        public static Registeruser EditUser(int id, Guid _doctorkey)
        {
            Registeruser    _edituser      = new Registeruser();
            GuruETCEntities _etc           = new GuruETCEntities();
            long?           DoctorKey      = _etc.DoctorProfiles.Where(d => d.UserGuid == _doctorkey).Select(d => d.Id).FirstOrDefault();
            PatientProfile  _profile       = _etc.PatientProfiles.Where(d => d.Id == id).FirstOrDefault();
            MembershipUser  _getUserbyName = Membership.GetUser(_profile.UserGuid);

            if (_profile != null)
            {
                if (_profile.DoctorId == DoctorKey)
                {
                    _edituser.Email             = _getUserbyName.Email;
                    _edituser.UserName          = _getUserbyName.UserName;
                    _edituser.PhoneNumber       = _profile.PhoneNumber;
                    _edituser.PersonalMotivator = _profile.PersonalMotivator;
                    _edituser.PatientHistorical = _profile.PersonalHistorical;
                    _edituser.MedicalHistory    = _profile.MedicalHistory;
                    _edituser.DOB      = _profile.DOB.Value.ToShortDateString();
                    _edituser.Address1 = _profile.Address1;
                    _edituser.Address2 = _profile.Address2;
                    _edituser.Name     = _profile.Name;
                }
            }
            return(_edituser);
        }
Example #2
0
        public static Registeruser patientInfobyregid(Guid getid)
        {
            GuruETCEntities _etc      = new GuruETCEntities();
            Registeruser    _edituser = new Registeruser();
            long?           PinfoId   = _etc.RegistrationCodes.Where(d => d.RegCode == getid).Select(d => d.PatientInfoId).FirstOrDefault();

            if (PinfoId != 0)
            {
                Patientinfo _getpinfo = _etc.Patientinfoes.Where(d => d.PID == PinfoId).FirstOrDefault();
                if (_getpinfo != null)
                {
                    _edituser.Email       = _getpinfo.Email;
                    _edituser.DOB         = _getpinfo.DOB.Value.ToShortDateString();
                    _edituser.Name        = _getpinfo.Name;
                    _edituser.Address1    = _getpinfo.Address1;
                    _edituser.Address2    = _getpinfo.Address2;
                    _edituser.PhoneNumber = _getpinfo.PhoneNumber;;
                    _edituser.DoctorKey   = (Guid)_getpinfo.refby;
                }
                else
                {
                    return(null);
                }
            }
            return(_edituser);
        }
Example #3
0
        public static string UpdateUser(Registeruser _updateUser, Guid _pkey)
        {
            string msg = "Error";

            try
            {
                GuruETCEntities _etc     = new GuruETCEntities();
                PatientProfile  _profile = _etc.PatientProfiles.Where(d => d.UserGuid == _pkey).FirstOrDefault();
                if (_profile != null)
                {
                    _profile.Name               = _updateUser.Name;
                    _profile.MedicalHistory     = _updateUser.MedicalHistory;
                    _profile.PersonalHistorical = _updateUser.PatientHistorical;
                    _profile.PersonalMotivator  = _updateUser.PersonalMotivator;
                    _profile.PhoneNumber        = _updateUser.PhoneNumber;
                    _profile.Address1           = _updateUser.Address1;
                    _profile.Address2           = _updateUser.Address2;
                    _profile.DOB = Convert.ToDateTime(_updateUser.DOB);
                    _etc.SaveChanges();
                    msg = "Success";
                }
            }
            catch (Exception ex)
            {
                msg = "Error";
            }
            return(msg);
        }
Example #4
0
        public static string RegisterPatient(Registeruser _newuser, Guid getuserkey)
        {
            GuruETC.DB.GuruETCEntities _etc = new DB.GuruETCEntities();

            long   DoctorId = _etc.DoctorProfiles.Where(d => d.UserGuid == getuserkey).Select(d => d.Id).FirstOrDefault();
            string msg      = string.Empty;
            MembershipCreateStatus sts;

            try
            {
                Membership.CreateUser(_newuser.UserName, _newuser.Password, _newuser.Email, null, null, true, out sts);
                if (sts == MembershipCreateStatus.Success)
                {
                    MembershipUser _getUser = Membership.GetUser(_newuser.UserName);
                    if (_getUser != null)
                    {
                        Roles.AddUserToRole(_getUser.UserName, "Patient");
                        PatientProfile _prof = new PatientProfile()
                        {
                            UserGuid = (Guid)_getUser.ProviderUserKey, PhoneNumber = _newuser.PhoneNumber, Address1 = _newuser.Address1, Address2 = _newuser.Address2, DOB = DateTime.Parse(_newuser.DOB), Name = _newuser.Name, MedicalHistory = _newuser.MedicalHistory, PersonalHistorical = _newuser.PatientHistorical, PersonalMotivator = _newuser.PersonalMotivator, DoctorId = DoctorId
                        };
                        _etc.AddToPatientProfiles(_prof);
                        _etc.SaveChanges();
                        msg = "A mail sent regarding registration!";

                        ThreadStart starterimg = () => SendMethod(_getUser.Email, "Your Dentist", _newuser.Name, _getUser.UserName, _newuser.Password);
                        Thread      threadimg  = new Thread(starterimg);
                        threadimg.ApartmentState = ApartmentState.STA;
                        threadimg.Start();
                    }
                }
                else
                {
                    msg = sts.ToString();
                }
            }
            catch
            {
                msg = "Error Occured!";
            }

            return(msg);
        }
Example #5
0
        public static Registeruser GetPatientRecord(Guid _getUserkey)
        {
            Registeruser    _edituser = new Registeruser();
            GuruETCEntities _etc      = new GuruETCEntities();
            PatientProfile  _profile  = _etc.PatientProfiles.Where(d => d.UserGuid == _getUserkey).FirstOrDefault();

            if (_profile != null)
            {
                _edituser.PhoneNumber       = _profile.PhoneNumber;
                _edituser.PersonalMotivator = _profile.PersonalMotivator;
                _edituser.PatientHistorical = _profile.PersonalHistorical;
                _edituser.MedicalHistory    = _profile.MedicalHistory;
                _edituser.DOB      = _profile.DOB.Value.ToShortDateString();
                _edituser.Address1 = _profile.Address1;
                _edituser.Address2 = _profile.Address2;
                _edituser.Name     = _profile.Name;
            }
            return(_edituser);
        }
Example #6
0
        public ActionResult Edit(PatientModel _user)
        {
            MembershipUser _getCurrentUser = Membership.GetUser(_user.UserName);
            if (_getCurrentUser.Email != _user.Email)
            {
                _getCurrentUser.Email = _user.Email;
                Membership.UpdateUser(_getCurrentUser);
            }

            Registeruser _updateUser = new Registeruser { Name = _user.Name, DOB = _user.DOB, Address1 = _user.Address1, Address2 = _user.Address2, MedicalHistory = _user.MedicalHistory, PatientHistorical = _user.PatientHistorical, PhoneNumber = _user.PhoneNumber, PersonalMotivator = _user.PersonalMotivator };

            Guid _getkey = (Guid)_getCurrentUser.ProviderUserKey;
            string msg = PatientManage.UpdateUser(_updateUser, _getkey);

            return RedirectToAction("PatientList", "Patient");
        }
Example #7
0
 public ActionResult Registration(PatientModel _pmodel)
 {
     Guid getuserkey = (Guid)_pmodel.doctorkey;
     if (getuserkey != default(Guid))
     {
         Registeruser _newuser = new Registeruser() { Name = _pmodel.Name, UserName = _pmodel.UserName, Password = _pmodel.Password, Address1 = _pmodel.Address1, Address2 = _pmodel.Address2, DOB = _pmodel.DOB, Email = _pmodel.Email, MedicalHistory = _pmodel.MedicalHistory, PatientHistorical = _pmodel.PatientHistorical, PhoneNumber = _pmodel.PhoneNumber, PersonalMotivator = _pmodel.PersonalMotivator };
         string msg = Registeruser.RegisterPatient(_newuser, getuserkey);
         ViewBag.result = msg;
     }
     else
     {
         ViewBag.result = "Error, invitation code has been suspended!";
     }
     return View(_pmodel);
 }
Example #8
0
 public static Registeruser EditUser(int id, Guid _doctorkey)
 {
     Registeruser _edituser = new Registeruser();
     GuruETCEntities _etc = new GuruETCEntities();
     long? DoctorKey = _etc.DoctorProfiles.Where(d => d.UserGuid == _doctorkey).Select(d => d.Id).FirstOrDefault();
     PatientProfile _profile = _etc.PatientProfiles.Where(d => d.Id == id).FirstOrDefault();
     MembershipUser _getUserbyName = Membership.GetUser(_profile.UserGuid);
     if (_profile != null)
     {
         if (_profile.DoctorId == DoctorKey)
         {
             _edituser.Email = _getUserbyName.Email;
             _edituser.UserName = _getUserbyName.UserName;
             _edituser.PhoneNumber = _profile.PhoneNumber;
             _edituser.PersonalMotivator = _profile.PersonalMotivator;
             _edituser.PatientHistorical = _profile.PersonalHistorical;
             _edituser.MedicalHistory = _profile.MedicalHistory;
             _edituser.DOB = _profile.DOB.Value.ToShortDateString();
             _edituser.Address1 = _profile.Address1;
             _edituser.Address2 = _profile.Address2;
             _edituser.Name = _profile.Name;
         }
     }
     return _edituser;
 }
Example #9
0
        public static string RegisterPatient(Registeruser _newuser, Guid getuserkey)
        {
            GuruETC.DB.GuruETCEntities _etc = new DB.GuruETCEntities();

            long DoctorId = _etc.DoctorProfiles.Where(d => d.UserGuid == getuserkey).Select(d => d.Id).FirstOrDefault();
            string msg = string.Empty;
            MembershipCreateStatus sts;
            try
            {
                Membership.CreateUser(_newuser.UserName, _newuser.Password, _newuser.Email, null, null, true, out sts);
                if (sts == MembershipCreateStatus.Success)
                {
                    MembershipUser _getUser = Membership.GetUser(_newuser.UserName);
                    if (_getUser != null)
                    {
                        Roles.AddUserToRole(_getUser.UserName, "Patient");
                        PatientProfile _prof = new PatientProfile() { UserGuid = (Guid)_getUser.ProviderUserKey, PhoneNumber = _newuser.PhoneNumber, Address1 = _newuser.Address1, Address2 = _newuser.Address2, DOB = DateTime.Parse(_newuser.DOB), Name = _newuser.Name, MedicalHistory = _newuser.MedicalHistory, PersonalHistorical = _newuser.PatientHistorical, PersonalMotivator = _newuser.PersonalMotivator, DoctorId = DoctorId };
                        _etc.AddToPatientProfiles(_prof);
                        _etc.SaveChanges();
                        msg = "A mail sent regarding registration!";

                        ThreadStart starterimg = () => SendMethod(_getUser.Email, "Your Dentist", _newuser.Name,_getUser.UserName, _newuser.Password);
                        Thread threadimg = new Thread(starterimg);
                        threadimg.ApartmentState = ApartmentState.STA;
                        threadimg.Start();

                    }
                }
                else
                {
                    msg = sts.ToString();
                }
            }
            catch
            {
                msg = "Error Occured!";
            }

            return msg;
        }
Example #10
0
 public static string UpdateUser(Registeruser _updateUser, Guid _pkey)
 {
     string msg = "Error";
     try
     {
         GuruETCEntities _etc = new GuruETCEntities();
         PatientProfile _profile = _etc.PatientProfiles.Where(d => d.UserGuid == _pkey).FirstOrDefault();
         if (_profile != null)
         {
             _profile.Name = _updateUser.Name;
             _profile.MedicalHistory = _updateUser.MedicalHistory;
             _profile.PersonalHistorical = _updateUser.PatientHistorical;
             _profile.PersonalMotivator = _updateUser.PersonalMotivator;
             _profile.PhoneNumber = _updateUser.PhoneNumber;
             _profile.Address1 = _updateUser.Address1;
             _profile.Address2 = _updateUser.Address2;
             _profile.DOB = Convert.ToDateTime(_updateUser.DOB);
             _etc.SaveChanges();
             msg = "Success";
         }
     }
     catch (Exception ex)
     {
         msg = "Error";
     }
     return msg;
 }
Example #11
0
        public static Registeruser patientInfobyregid(Guid getid)
        {
            GuruETCEntities _etc = new GuruETCEntities();
            Registeruser _edituser = new Registeruser();
            long? PinfoId = _etc.RegistrationCodes.Where(d => d.RegCode == getid).Select(d => d.PatientInfoId).FirstOrDefault();
            if (PinfoId != 0)
            {
                Patientinfo _getpinfo = _etc.Patientinfoes.Where(d => d.PID == PinfoId).FirstOrDefault();
                if (_getpinfo != null)
                {
                    _edituser.Email = _getpinfo.Email;
                    _edituser.DOB = _getpinfo.DOB.Value.ToShortDateString();
                    _edituser.Name = _getpinfo.Name;
                    _edituser.Address1 = _getpinfo.Address1;
                    _edituser.Address2 = _getpinfo.Address2;
                    _edituser.PhoneNumber = _getpinfo.PhoneNumber; ;
                    _edituser.DoctorKey = (Guid)_getpinfo.refby;

                }
                else {
                    return null;
                }
            }
            return _edituser;
        }
Example #12
0
 public static Registeruser GetPatientRecord(Guid _getUserkey)
 {
     Registeruser _edituser = new Registeruser();
     GuruETCEntities _etc = new GuruETCEntities();
     PatientProfile _profile = _etc.PatientProfiles.Where(d => d.UserGuid == _getUserkey).FirstOrDefault();
     if (_profile != null)
     {
         _edituser.PhoneNumber = _profile.PhoneNumber;
         _edituser.PersonalMotivator = _profile.PersonalMotivator;
         _edituser.PatientHistorical = _profile.PersonalHistorical;
         _edituser.MedicalHistory = _profile.MedicalHistory;
         _edituser.DOB = _profile.DOB.Value.ToShortDateString();
         _edituser.Address1 = _profile.Address1;
         _edituser.Address2 = _profile.Address2;
         _edituser.Name = _profile.Name;
     }
     return _edituser;
 }