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; }
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; }
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; }
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); }
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); }
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); }
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); }
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; }
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); }
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; }
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); }
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); }
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 { } }
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; }