/// <summary>
 /// Create a new PatientProfile object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 public static PatientProfile CreatePatientProfile(global::System.Int64 id)
 {
     PatientProfile patientProfile = new PatientProfile();
     patientProfile.Id = id;
     return patientProfile;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the PatientProfiles EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToPatientProfiles(PatientProfile patientProfile)
 {
     base.AddObject("PatientProfiles", patientProfile);
 }
Example #3
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;
        }