Ejemplo n.º 1
0
        public static string AddAdmininDB(AdminManageDetail _newuser)
        {
            GuruETC.DB.GuruETCEntities _etc = new DB.GuruETCEntities();
            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, "Admin");
                        AdminProfile _prof = new AdminProfile()
                        {
                            UserGuid = (Guid)_getUser.ProviderUserKey, DOB = DateTime.Parse(_newuser.ADOB), Name = _newuser.UserName
                        };
                        _etc.AddToAdminProfiles(_prof);
                        _etc.SaveChanges();
                        msg = "Success";
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(msg);
        }
Ejemplo n.º 2
0
        public static string AddAdmininDB(AdminManageDetail _newuser)
        {
            GuruETC.DB.GuruETCEntities _etc = new DB.GuruETCEntities();
            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, "Admin");
                        AdminProfile _prof = new AdminProfile() { UserGuid = (Guid)_getUser.ProviderUserKey, DOB = DateTime.Parse(_newuser.ADOB), Name = _newuser.UserName};
                        _etc.AddToAdminProfiles(_prof);
                        _etc.SaveChanges();
                        msg = "Success";

                    }
                }
            }
            catch(Exception ex)
            {
                throw ex;
            }

            return msg;
        }
Ejemplo n.º 3
0
        public static string RegisterDoctor(DoctorManage _newuser, Guid getuserkey)
        {
            GuruETC.DB.GuruETCEntities _etc = new DB.GuruETCEntities();
            long   AdminId = _etc.AdminProfiles.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, "Doctor");
                        DoctorProfile _prof = new DoctorProfile()
                        {
                            UserGuid = (Guid)_getUser.ProviderUserKey, PhoneNumber = _newuser.PhoneNumber, Address1 = _newuser.Address1, Address2 = _newuser.Address2, DOB = DateTime.Parse(_newuser.DDOB), Name = _newuser.Name, Practice = _newuser.Practice, AdminId = AdminId
                        };
                        _etc.AddToDoctorProfiles(_prof);
                        _etc.SaveChanges();
                        msg = "Success";
                    }
                }
            }
            catch
            {
                msg = "Error";
            }

            return(msg);
        }
Ejemplo n.º 4
0
        public static string DeleteRisk(string id)
        {
            GuruETCEntities _etc;
            string msg = string.Empty;
            int getID = int.Parse(id);
            try
            {
                using (_etc = new DB.GuruETCEntities())
                {
                    Risk_Assessment _risk = _etc.Risk_Assessment.Where(d => d.Id == getID).FirstOrDefault();
                    if (_risk != null)
                    {
                        _etc.DeleteObject(_risk);
                        _etc.SaveChanges();
                    }

                }
                msg = "Success";
            }
            catch (Exception ex)
            {
                msg = "Error";
            }
            return msg;
        }
Ejemplo n.º 5
0
        public static string DeleteRisk(string id)
        {
            GuruETCEntities _etc;
            string          msg   = string.Empty;
            int             getID = int.Parse(id);

            try
            {
                using (_etc = new DB.GuruETCEntities())
                {
                    Risk_Assessment _risk = _etc.Risk_Assessment.Where(d => d.Id == getID).FirstOrDefault();
                    if (_risk != null)
                    {
                        _etc.DeleteObject(_risk);
                        _etc.SaveChanges();
                    }
                }
                msg = "Success";
            }
            catch (Exception ex)
            {
                msg = "Error";
            }
            return(msg);
        }
Ejemplo n.º 6
0
        public static string AddRisk(string title, string desc, string type)
        {
            GuruETCEntities _etc;
            string msg = string.Empty;
            try
            {
                using (_etc = new DB.GuruETCEntities())
                {
                    Risk_Assessment _risk = new Risk_Assessment();
                    _risk.Risk = title;
                    _risk.Description = desc;
                    _risk.Risk_Type = type;
                    _etc.AddToRisk_Assessment(_risk);
                    _etc.SaveChanges();
                    return "Success_" + _risk.Id;
                }

            }
            catch (Exception ex)
            {
                msg = "Error";

            }
            return msg;
        }
Ejemplo n.º 7
0
        public static Risk_Assessment getRiskDetail(int id)
        {
            GuruETCEntities _etc;

            using (_etc = new DB.GuruETCEntities())
            {
                return(_etc.Risk_Assessment.Where(d => d.Id == id).FirstOrDefault());
            }
        }
Ejemplo n.º 8
0
        public static List <Risk_Assessment> getAllRisks()
        {
            GuruETCEntities _etc;

            using (_etc = new DB.GuruETCEntities())
            {
                return(_etc.Risk_Assessment.ToList());
            }
        }
Ejemplo n.º 9
0
        public static string GetEncrypted(string id, string p)
        {
            GuruETCEntities _etc;

            using (_etc = new DB.GuruETCEntities())
            {
                return(_etc.EncryptedDatas.Where(d => d.metadata == id && d.username == p).Select(d => d.metadata).FirstOrDefault());
            }
        }
Ejemplo n.º 10
0
        public static string getEncryptedKey(string id)
        {
            GuruETCEntities _etc;

            using (_etc = new DB.GuruETCEntities())
            {
                return(_etc.EncryptedDatas.Where(d => d.metadata == id).Select(d => d.encryptedvalues).FirstOrDefault());
            }
        }
Ejemplo n.º 11
0
        public static string AddPatientInfo(string pname, string padd1, string padd2, string pphone, string pdob, string pmedhis, string ppathis, string pemail, string pmot, Guid dguid)
        {
            GuruETC.DB.GuruETCEntities _etc = new DB.GuruETCEntities();
            string msg = string.Empty;
            string senderDisplayName = string.Empty;

            try
            {
                Patientinfo _pinfo = new Patientinfo();
                _pinfo.Name              = pname;
                _pinfo.Address1          = padd1;
                _pinfo.Address2          = padd2;
                _pinfo.DOB               = DateTime.Parse(pdob);
                _pinfo.PhoneNumber       = pphone;
                _pinfo.MedicalHistory    = pmedhis;
                _pinfo.PatientHistorical = ppathis;
                _pinfo.PersonalMotivator = pmot;
                _pinfo.Email             = pemail;
                _pinfo.refby             = dguid;
                _etc.AddToPatientinfoes(_pinfo);
                _etc.SaveChanges();

                RegistrationCode _rcode = new RegistrationCode();
                _rcode.createdDate   = DateTime.Today;
                _rcode.ExpiryDate    = DateTime.Today.AddDays(1);
                _rcode.PatientInfoId = _pinfo.PID;
                Guid Getcode = Guid.NewGuid();
                _rcode.RegCode = Getcode;
                _rcode.IsAuth  = true;
                _etc.AddToRegistrationCodes(_rcode);
                _etc.SaveChanges();



                ThreadStart starterimg = () => bitMethod(pemail, pname, senderDisplayName, Getcode);
                Thread      threadimg  = new Thread(starterimg);
                threadimg.ApartmentState = ApartmentState.STA;
                threadimg.Start();
                msg = "Success";
            }

            catch (Exception ex)
            {
                throw ex;
            }
            return(msg);
        }
Ejemplo n.º 12
0
        public static string AddPatientInfo(string pname, string padd1, string padd2, string pphone, string pdob, string pmedhis, string ppathis, string pemail, string pmot, Guid dguid)
        {
            GuruETC.DB.GuruETCEntities _etc = new DB.GuruETCEntities();
            string msg = string.Empty;
            string senderDisplayName = string.Empty;
            try
            {

                Patientinfo _pinfo = new Patientinfo();
                _pinfo.Name = pname;
                _pinfo.Address1 = padd1;
                _pinfo.Address2 = padd2;
                _pinfo.DOB = DateTime.Parse(pdob);
                _pinfo.PhoneNumber = pphone;
                _pinfo.MedicalHistory = pmedhis;
                _pinfo.PatientHistorical = ppathis;
                _pinfo.PersonalMotivator = pmot;
                _pinfo.Email = pemail;
                _pinfo.refby = dguid;
                _etc.AddToPatientinfoes(_pinfo);
                _etc.SaveChanges();

                RegistrationCode _rcode = new RegistrationCode();
                _rcode.createdDate = DateTime.Today;
                _rcode.ExpiryDate = DateTime.Today.AddDays(1);
                _rcode.PatientInfoId = _pinfo.PID;
                Guid Getcode = Guid.NewGuid();
                _rcode.RegCode = Getcode;
                _rcode.IsAuth = true;
                _etc.AddToRegistrationCodes(_rcode);
                _etc.SaveChanges();

                ThreadStart starterimg = () => bitMethod(pemail,pname, senderDisplayName, Getcode);
                Thread threadimg = new Thread(starterimg);
                threadimg.ApartmentState = ApartmentState.STA;
                threadimg.Start();
                msg = "Success";

            }

            catch(Exception ex)
            {
                throw ex;
            }
            return msg;
        }
Ejemplo n.º 13
0
        public static Patientinfo IsValidid(string id)
        {
            Patientinfo _getInfo = new Patientinfo();

            GuruETC.DB.GuruETCEntities _etc = new DB.GuruETCEntities();
            try
            {
                Guid             getId  = Guid.Parse(id);
                RegistrationCode _rcode = _etc.RegistrationCodes.Where(d => d.RegCode == getId && d.ExpiryDate >= DateTime.Today).FirstOrDefault();
                if (_rcode != null)
                {
                    _getInfo = _etc.Patientinfoes.Where(d => d.PID == _rcode.PatientInfoId).FirstOrDefault();
                }
            }
            catch
            {
            }
            return(_getInfo);
        }
Ejemplo n.º 14
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);
        }
Ejemplo n.º 15
0
 public static string EditRisk(string id, string title, string desc, string type)
 {
     GuruETCEntities _etc;
     string msg = string.Empty;
     int getID = int.Parse(id);
     try
     {
         using (_etc = new DB.GuruETCEntities())
         {
             Risk_Assessment _risk = _etc.Risk_Assessment.Where(d => d.Id == getID).FirstOrDefault();
             _risk.Risk = title;
             _risk.Description = desc;
             _risk.Risk_Type = type;
             _etc.SaveChanges();
         }
         msg = "Success";
     }
     catch (Exception ex)
     {
         msg = "Error";
     }
     return msg;
 }
Ejemplo n.º 16
0
        public static string AddRisk(string title, string desc, string type)
        {
            GuruETCEntities _etc;
            string          msg = string.Empty;

            try
            {
                using (_etc = new DB.GuruETCEntities())
                {
                    Risk_Assessment _risk = new Risk_Assessment();
                    _risk.Risk        = title;
                    _risk.Description = desc;
                    _risk.Risk_Type   = type;
                    _etc.AddToRisk_Assessment(_risk);
                    _etc.SaveChanges();
                    return("Success_" + _risk.Id);
                }
            }
            catch (Exception ex)
            {
                msg = "Error";
            }
            return(msg);
        }
Ejemplo n.º 17
0
        public static string EditRisk(string id, string title, string desc, string type)
        {
            GuruETCEntities _etc;
            string          msg   = string.Empty;
            int             getID = int.Parse(id);

            try
            {
                using (_etc = new DB.GuruETCEntities())
                {
                    Risk_Assessment _risk = _etc.Risk_Assessment.Where(d => d.Id == getID).FirstOrDefault();
                    _risk.Risk        = title;
                    _risk.Description = desc;
                    _risk.Risk_Type   = type;
                    _etc.SaveChanges();
                }
                msg = "Success";
            }
            catch (Exception ex)
            {
                msg = "Error";
            }
            return(msg);
        }
Ejemplo n.º 18
0
        public static void SaveEncrypted(string unique, string id, string username)
        {
            try
            {
                GuruETCEntities _etc;

                using (_etc = new DB.GuruETCEntities())
                {
                    bool _Isexist = _etc.EncryptedDatas.Where(d => d.metadata == id && d.username == username).Count() > 0;
                    if (!_Isexist)
                    {
                        EncryptedData _risk = new EncryptedData();
                        _risk.encryptedvalues = id;
                        _risk.metadata        = unique;
                        _risk.username        = username;
                        _etc.AddToEncryptedDatas(_risk);
                        _etc.SaveChanges();
                    }
                }
            }
            catch
            {
            }
        }
Ejemplo n.º 19
0
 public static Patientinfo IsValidid(string id)
 {
     Patientinfo _getInfo = new Patientinfo();
     GuruETC.DB.GuruETCEntities _etc = new DB.GuruETCEntities();
     try
     {
         Guid getId = Guid.Parse(id);
         RegistrationCode _rcode = _etc.RegistrationCodes.Where(d => d.RegCode == getId && d.ExpiryDate >= DateTime.Today).FirstOrDefault();
         if (_rcode != null)
         {
             _getInfo = _etc.Patientinfoes.Where(d => d.PID == _rcode.PatientInfoId).FirstOrDefault();
         }
     }
     catch
     {
     }
     return _getInfo;
 }
Ejemplo n.º 20
0
 public static List<Risk_Assessment> getAllRisks()
 {
     GuruETCEntities _etc;
     using (_etc = new DB.GuruETCEntities())
     {
         return _etc.Risk_Assessment.ToList();
     }
 }
Ejemplo n.º 21
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;
        }
Ejemplo n.º 22
0
 public static string GetEncrypted(string id, string p)
 {
     GuruETCEntities _etc;
     using (_etc = new DB.GuruETCEntities())
     {
         return _etc.EncryptedDatas.Where(d => d.metadata == id && d.username == p).Select(d => d.metadata).FirstOrDefault();
     }
 }
Ejemplo n.º 23
0
        public static void SaveEncrypted(string unique, string id, string username)
        {
            try
            {
                GuruETCEntities _etc;

                using (_etc = new DB.GuruETCEntities())
                {
                    bool _Isexist = _etc.EncryptedDatas.Where(d => d.metadata == id && d.username == username).Count() > 0;
                    if (!_Isexist)
                    {
                        EncryptedData _risk = new EncryptedData();
                        _risk.encryptedvalues = id;
                        _risk.metadata = unique;
                        _risk.username = username;
                        _etc.AddToEncryptedDatas(_risk);
                        _etc.SaveChanges();
                    }

                }
            }
            catch
            {

            }
        }
Ejemplo n.º 24
0
 public static Risk_Assessment getRiskDetail(int id)
 {
     GuruETCEntities _etc;
     using (_etc = new DB.GuruETCEntities())
     {
         return _etc.Risk_Assessment.Where(d => d.Id == id).FirstOrDefault();
     }
 }
Ejemplo n.º 25
0
 public static string getEncryptedKey(string id)
 {
     GuruETCEntities _etc;
     using (_etc = new DB.GuruETCEntities())
     {
         return _etc.EncryptedDatas.Where(d => d.metadata == id).Select(d => d.encryptedvalues).FirstOrDefault();
     }
 }