public void Register(SponserUser user) { Entites.sp_RegisterSponser( user.FirstName, user.LastName, user.Company.ID, user.Role.ID, user.TerritoryCovergae_All.Value ? 1: 0, user.TerritoryCovergae_BC.Value ? 1 : 0, user.TerritoryCovergae_AB.Value ? 1 : 0, user.TerritoryCovergae_SK.Value ? 1 : 0, user.TerritoryCovergae_MB.Value ? 1 : 0, user.TerritoryCovergae_ON.Value ? 1 : 0, user.TerritoryCovergae_QC.Value ? 1 : 0, user.TerritoryCovergae_NS.Value ? 1 : 0, user.TerritoryCovergae_NB.Value ? 1 : 0, user.TerritoryCovergae_NL.Value ? 1 : 0, user.TerritoryCovergae_PEI.Value ? 1 : 0, user.Username, user.Password ); }
protected void imgLogin_clicked(object sender, System.EventArgs e) { SponserRepository sponserRepo = new SponserRepository(); string userName = txtUsername.Text; string pass = this.txtPass.Text; pass = Encryptor.Encrypt(pass); if (sponserRepo.Authenticate(userName, pass)) { CookieHelper.WriteCookie(this.txtUsername.Text, chkRemember.Checked); SponserUser usr = UserHelper.SetupUserOnLogin(userName, pass); HttpContext.Current.User = new GenericPrincipal(User.Identity, null); FormsAuthentication.SetAuthCookie(userName, false); Response.Redirect(UserHelper.GetURLByRole(usr)); } else { lblResult.Visible = true; } }
protected void Page_Load(object sender, EventArgs e) { user = VistaDM.Admin.Code.UserHelper.GetLoggedInUser(HttpContext.Current.Session); if (Request.QueryString[Constants.PROVINCEID] != null) { provinceID = Int32.Parse(Request.QueryString[Constants.PROVINCEID].ToString()); } if (Request.QueryString[Constants.IS_PCP] != null && Request.QueryString[Constants.IS_PCP].ToString() != "-1") { isPCP = Request.QueryString[Constants.IS_PCP].ToString() == "1"; } if (Request.QueryString["ADMIN"] != null) { returnToAdmin = Int32.Parse(Request.QueryString["ADMIN"].ToString()) == 1; } if (!Page.IsPostBack) { LoadSearchModes(); DisplayPanels(); } }
public List <FSA> GetFSAList(SponserUser user) { List <FSA> retLst = new List <FSA>(); var fsaLst = Entites.sp_GetFSA ( user.TerritoryCovergae_AB, user.TerritoryCovergae_BC, user.TerritoryCovergae_MB, user.TerritoryCovergae_NB, user.TerritoryCovergae_NL, user.TerritoryCovergae_NS, user.TerritoryCovergae_ON, user.TerritoryCovergae_PEI, user.TerritoryCovergae_QC, user.TerritoryCovergae_SK ).ToList(); foreach (var item in fsaLst) { if (!string.IsNullOrEmpty(item.FSA)) { retLst.Add( new FSA() { Name = item.FSA } ); } } return(retLst); }
public List <BI> Get_BI_List(SponserUser user) { List <BI> retLst = new List <BI>(); var biLst = Entites.sp_Get_BI ( user.TerritoryCovergae_AB, user.TerritoryCovergae_BC, user.TerritoryCovergae_MB, user.TerritoryCovergae_NB, user.TerritoryCovergae_NL, user.TerritoryCovergae_NS, user.TerritoryCovergae_ON, user.TerritoryCovergae_PEI, user.TerritoryCovergae_QC, user.TerritoryCovergae_SK ).ToList(); foreach (var item in biLst) { if (item.BI.HasValue) { retLst.Add( new BI() { Name = item.BI.Value } ); } } return(retLst); }
public List <Lilly> Get_Lilly_List(SponserUser user) { List <Lilly> retLst = new List <Lilly>(); var lillyLst = Entites.sp_Get_Lilly ( user.TerritoryCovergae_AB, user.TerritoryCovergae_BC, user.TerritoryCovergae_MB, user.TerritoryCovergae_NB, user.TerritoryCovergae_NL, user.TerritoryCovergae_NS, user.TerritoryCovergae_ON, user.TerritoryCovergae_PEI, user.TerritoryCovergae_QC, user.TerritoryCovergae_SK ).ToList(); foreach (var item in lillyLst) { if (!string.IsNullOrEmpty(item.Lilly)) { retLst.Add( new Lilly() { Name = item.Lilly } ); } } return(retLst); }
private void LoadData() { SponserUser user = VistaDM.Admin.Code.UserHelper.GetLoggedInUser(HttpContext.Current.Session); Invitee inv = invRepos.GetDetail(physicianID); if (inv != null) { this.txtFirstName.Text = inv.FirstName; this.txtLastName.Text = inv.LastName; this.txtClinic.Text = inv.PrimaryWorkplace; this.txtAddress.Text = inv.Address; this.txtCity.Text = inv.City; this.txtPostalCode.Text = inv.PostalCode; this.txtPhone.Text = inv.Phone; this.txtFax.Text = inv.Fax; this.txtEmail.Text = inv.OptInEmail; this.txtComments.Text = inv.Comments; this.txtUnique.Text = inv.RegistrationCode; lblFN.Text = inv.YourFirstName; lblLN.Text = inv.YourLastName; lblAdderEmail.Text = inv.YourEmail; if (inv.BITerritoryID.HasValue) { this.txtBI.Text = inv.BITerritoryID.Value.ToString(); } this.txtLilly.Text = inv.LillyID; lblType.Text = inv.PhysicianType == Enums.PhysicianType.PCP ? "PCP" : "CS"; this.lblUserName.Text = inv.UserName; //squaredThree.Checked = inv.OptInEmail; if (inv.Province.ID.HasValue) { ddProvince.SelectedValue = inv.Province.ID.Value.ToString(); } else { ddProvince.SelectedValue = Constants.NOID.ToString(); } if (!user.IsAdmin) { if (inv.PhysicianType == Enums.PhysicianType.PCP) { pnlEmail.Visible = inv.Invited; } else { pnlEmail.Visible = false; } } } }
protected override void OnInitComplete(EventArgs e) { // have to put in Page_Init, Page_Load doesn't work, it interferes with InvitedCheckbox_CheckedChanged and possibly other postback functions if (Request.QueryString[Constants.PROVINCEID] != null) { provinceID = Int32.Parse(Request.QueryString[Constants.PROVINCEID].ToString()); } if (Request.QueryString[Constants.IS_PCP] != null && Request.QueryString[Constants.IS_PCP].ToString() != "-1") { isPCP = Request.QueryString[Constants.IS_PCP].ToString() == "1"; } if (provinceID != -1) { hlChangeProgram.NavigateUrl += string.Format("?{0}={1}", Constants.PROVINCEID, provinceID.ToString()); } if (isPCP.HasValue) { hlChangeRegion.NavigateUrl += string.Format("?{0}={1}", Constants.IS_PCP, (isPCP.Value ? "1" : "0")); } user = VistaDM.Admin.Code.UserHelper.GetLoggedInUser(HttpContext.Current.Session); if (!string.IsNullOrEmpty(user.Username)) { LoadRegistrationStatus(); if (provinceID == -1) { LoadData(isPCP); } else { LoadData(provinceID, isPCP); } hlChangeProgram.Enabled = true; hlChangeRegion.Enabled = true; } else { Response.Redirect("~/AdminDefault.aspx"); } //LoadControlsForSponser(); base.OnInitComplete(e); }
protected void Page_Load(object sender, EventArgs e) { SponserUser user = VistaDM.Admin.Code.UserHelper.GetLoggedInUser(HttpContext.Current.Session); if (!string.IsNullOrEmpty(user.Username)) { pnlUsername.Visible = true; if (user.FirstName.ToLower() == "admin".ToLower()) { lblUserName.Text = "CHRC"; } else { lblUserName.Text = user.FirstName; } } }
protected override void OnInitComplete(EventArgs e) { // have to put in Page_Init, Page_Load doesn't work, it interferes with InvitedCheckbox_CheckedChanged and possibly other postback functions if (Request.QueryString[Constants.PROVINCEID] != null) { provinceID = Int32.Parse(Request.QueryString[Constants.PROVINCEID].ToString()); } if (Request.QueryString[Constants.IS_PCP] != null && Request.QueryString[Constants.IS_PCP].ToString() != "-1") { isPCP = Request.QueryString[Constants.IS_PCP].ToString() == "1"; } user = VistaDM.Admin.Code.UserHelper.GetLoggedInUser(HttpContext.Current.Session); LoadRegistrationStatus(); if (provinceID == -1) { LoadData(isPCP); } else { LoadData(provinceID, isPCP); } //if (!UserHelper.CanSelectProgram(user)) //{ // hlChangeProgram.Enabled = false; // hlChangeProgram.ImageUrl = "~/images/button_changeprogram_gray.png"; //} //if (!user.HasMoreThanOneProvince()) //{ // hlChangeRegion.Enabled = false; // hlChangeRegion.ImageUrl = "~/images/button_changeregion_gray.png"; //} //LoadControlsForSponser(); base.OnInitComplete(e); }
public static bool CanSelectProgram(SponserUser usr) { //1 Speciality Representative //2 Primary Care Representative //3 Hybrid Sales Representative //4 Sales Manager //5 Head Office bool retVal = false; switch (usr.Role.ID) { case 1: retVal = false; break; case 2: retVal = false; break; case 3: retVal = true; break; case 4: retVal = true; break; case 5: retVal = true; break; } return(retVal); }
protected void imgLogin_clicked(object sender, EventArgs e) { SponserRepository sponserRepo = new SponserRepository(); string userName = txtUsername.Text; string pass = this.txtPass.Text; if (userName == Constants.ADMIN_USER && pass == Constants.ADMIN_PWD) { SponserUser usr = UserHelper.SetupAdminOnLogin(userName); HttpContext.Current.User = new GenericPrincipal(User.Identity, null); FormsAuthentication.SetAuthCookie(userName, false); Response.Redirect("~/SelectProgram.aspx"); } else { lblResult.Visible = true; } }
public SponserUser GetAdminDetails(string userName) { SponserUser retUser = new SponserUser(); retUser.Username = userName; retUser.FirstName = "admin"; retUser.LastName = "admin"; retUser.TerritoryCovergae_All = true; retUser.TerritoryCovergae_BC = true; retUser.TerritoryCovergae_AB = true; retUser.TerritoryCovergae_SK = true; retUser.TerritoryCovergae_MB = true; retUser.TerritoryCovergae_ON = true; retUser.TerritoryCovergae_QC = true; retUser.TerritoryCovergae_NS = true; retUser.TerritoryCovergae_NB = true; retUser.TerritoryCovergae_NL = true; retUser.TerritoryCovergae_PEI = true; retUser.IsAdmin = true; return(retUser); }
public static string CanSelectRegion(SponserUser usr) { //1 Speciality Representative //2 Primary Care Representative //3 Hybrid Sales Representative //4 Sales Manager //5 Head Office string retURL = string.Empty; switch (usr.Role.ID) { case 1: retURL = "~/SelectRegion.aspx"; break; case 2: retURL = "~/SelectRegion.aspx"; break; case 3: retURL = "~/SelectProgram.aspx"; break; case 4: retURL = "~/SelectProgram.aspx"; break; case 5: retURL = "~/SelectProgram.aspx"; break; } return(retURL); }
protected void Page_Load(object sender, EventArgs e) { SponserUser user = VistaDM.Admin.Code.UserHelper.GetLoggedInUser(HttpContext.Current.Session); if (Request.QueryString[Constants.PROVINCEID] != null) { provinceID = Int32.Parse(Request.QueryString[Constants.PROVINCEID].ToString()); } if (user.IsAdmin) { hlPCP.NavigateUrl = string.Format("~/SelectRegion.aspx?{0}=1", Constants.IS_PCP); hlCS.NavigateUrl = string.Format("~/SelectRegion.aspx?{0}=0", Constants.IS_PCP); } else { if (user.HasMoreThanOneProvince() || provinceID == 0) { hlPCP.NavigateUrl = string.Format("~/SelectRegion.aspx?{0}=1", Constants.IS_PCP); hlCS.NavigateUrl = string.Format("~/SelectRegion.aspx?{0}=0", Constants.IS_PCP); } else { if (provinceID != -1) { hlPCP.NavigateUrl = string.Format("~/Default.aspx?{0}=1&{1}={2}", Constants.IS_PCP, Constants.PROVINCEID, provinceID.ToString()); hlCS.NavigateUrl = string.Format("~/Default.aspx?{0}=0&{1}={2}", Constants.IS_PCP, Constants.PROVINCEID, provinceID.ToString()); } else { hlPCP.NavigateUrl = string.Format("~/Default.aspx?{0}=1", Constants.IS_PCP); hlCS.NavigateUrl = string.Format("~/Default.aspx?{0}=0", Constants.IS_PCP); } } } }
protected void Page_Load(object sender, EventArgs e) { user = VistaDM.Admin.Code.UserHelper.GetLoggedInUser(HttpContext.Current.Session); //if ( VistaDM.Admin.Code.UserHelper.GetLoggedInUser(HttpContext.Current.Session).HasMoreThanOneProvince()) //{ // Response.Redirect("~/default.aspx"); //} if (Request.QueryString[Constants.IS_PCP] != null) { isPCP = Int32.Parse(Request.QueryString[Constants.IS_PCP].ToString()); } else { isPCP = -1; } InitializeImages(); InitializeHyperLinks(); Page.DataBind(); }
public SponserUser GetDetailsByUsername(string userName) { SponserUser retUser = new SponserUser(); var item = Entites.sp_GetSponserDetails_UserName(userName).SingleOrDefault(); if (item != null) { retUser.UserID = item.UserID.Value; retUser.Company = new Company() { ID = item.CompanyID.Value, Name = item.CompanyName }; retUser.Role = new Role() { ID = item.RoleID.Value, Name = item.RoleName }; retUser.Username = item.Username; retUser.Password = item.Password; retUser.FirstName = item.FirstName; retUser.LastName = item.LastName; retUser.TerritoryCovergae_All = item.TerritoryCovergae_All.HasValue ? item.TerritoryCovergae_All.Value : false; retUser.TerritoryCovergae_BC = item.TerritoryCovergae_BC.HasValue ? item.TerritoryCovergae_BC.Value : false; retUser.TerritoryCovergae_AB = item.TerritoryCovergae_AB.HasValue ? item.TerritoryCovergae_AB.Value : false; retUser.TerritoryCovergae_SK = item.TerritoryCovergae_SK.HasValue ? item.TerritoryCovergae_SK.Value : false; retUser.TerritoryCovergae_MB = item.TerritoryCovergae_MB.HasValue ? item.TerritoryCovergae_MB.Value : false; retUser.TerritoryCovergae_ON = item.TerritoryCovergae_ON.HasValue ? item.TerritoryCovergae_ON.Value : false; retUser.TerritoryCovergae_QC = item.TerritoryCovergae_QC.HasValue ? item.TerritoryCovergae_QC.Value : false; retUser.TerritoryCovergae_NS = item.TerritoryCovergae_NS.HasValue ? item.TerritoryCovergae_NS.Value : false; retUser.TerritoryCovergae_NB = item.TerritoryCovergae_NB.HasValue ? item.TerritoryCovergae_NB.Value : false; retUser.TerritoryCovergae_NL = item.TerritoryCovergae_NL.HasValue ? item.TerritoryCovergae_NL.Value : false; retUser.TerritoryCovergae_PEI = item.TerritoryCovergae_PEI.HasValue ? item.TerritoryCovergae_PEI.Value : false; } return(retUser); }
protected void imgSubmit_clicked(object sender, System.EventArgs e) { if (string.IsNullOrEmpty(this.rdoType.SelectedValue)) { lblTypeReq.Visible = true; return; } bool errored = false; RegCode regCode = new RegCode(); RegCodeRepository regRepos = new RegCodeRepository(); Invitee newInvitee = new Invitee(); try { newInvitee.FirstName = txtFirstName.Text; newInvitee.LastName = txtLastName.Text; newInvitee.PrimaryWorkplace = txtClinic.Text; newInvitee.Address = txtAddress.Text; newInvitee.City = txtCity.Text; newInvitee.ProvinceID = Int32.Parse(ddProvince.SelectedValue.ToString()); newInvitee.PostalCode = txtPostalCode.Text; newInvitee.Phone = txtPhone.Text; newInvitee.Fax = txtFax.Text; newInvitee.OptInEmail = txtEmail.Text; newInvitee.Comments = txtComments.Text; newInvitee.YourFirstName = txtYourFirstName.Text; newInvitee.YourLastName = txtYourLastName.Text; newInvitee.YourEmail = txtYourEmail.Text; if (!string.IsNullOrEmpty(txtBI.Text)) { newInvitee.BITerritoryID = Int32.Parse(this.txtBI.Text); } newInvitee.LillyID = this.txtLilly.Text; if (this.rdoType.SelectedValue == "1") { newInvitee.PhysicianType = Enums.PhysicianType.PCP; } else if (this.rdoType.SelectedValue == "2") { newInvitee.PhysicianType = Enums.PhysicianType.CS; } regCode = regRepos.GetNewCode(); newInvitee.RegistrationCode = regCode.Code; SponserUser user = VistaDM.Admin.Code.UserHelper.GetLoggedInUser(HttpContext.Current.Session); newInvitee.IsAdminApproved = user.IsAdmin; invRepos.AddInvitee(newInvitee); regRepos.UpdateRegCode(regCode.ID); } catch (Exception exc) { errored = true; } if (!errored) { ScriptManager.RegisterStartupScript(this, GetType(), "", "window.alert('Physician Record updated successfully'); parent.location.reload(true); parent.jQuery.fancybox.close();", true); } else { ScriptManager.RegisterStartupScript(this, GetType(), "", "window.alert('Physician Record CANNOT be updated, please try again later'); parent.location.reload(true); parent.jQuery.fancybox.close();", true); } }
public static string GetURLByRole(SponserUser usr) { //1 Speciality Representative //2 Primary Care Representative //3 Hybrid Sales Representative //4 Sales Manager //5 Head Office string retURL = string.Empty; switch (usr.Role.ID) { case 1: if (usr.HasMoreThanOneProvince()) { retURL = "~/SelectRegion.aspx"; } else { retURL = string.Format("~/default.aspx?{0}={1}", Constants.PROVINCEID, usr.GetSelectedProvince()); } break; case 2: if (usr.HasMoreThanOneProvince()) { retURL = "~/SelectRegion.aspx"; } else { retURL = string.Format("~/default.aspx?{0}={1}", Constants.PROVINCEID, usr.GetSelectedProvince()); } break; case 3: if (usr.HasMoreThanOneProvince()) { retURL = "~/SelectProgram.aspx"; } else { retURL = string.Format("~/SelectProgram.aspx?{0}={1}", Constants.PROVINCEID, usr.GetSelectedProvince()); } break; case 4: if (usr.HasMoreThanOneProvince()) { retURL = "~/SelectProgram.aspx"; } else { retURL = string.Format("~/SelectProgram.aspx?{0}={1}", Constants.PROVINCEID, usr.GetSelectedProvince()); } break; case 5: if (usr.HasMoreThanOneProvince()) { retURL = "~/SelectProgram.aspx"; } else { if (usr.TerritoryCovergae_All.HasValue && usr.TerritoryCovergae_All.Value) { retURL = string.Format("~/SelectProgram.aspx?{0}={1}", Constants.PROVINCEID, 0); } else { retURL = string.Format("~/SelectProgram.aspx?{0}={1}", Constants.PROVINCEID, usr.GetSelectedProvince()); } } break; } return(retURL); }
protected void imgSubmit_clicked(object sender, System.EventArgs e) { if (!Page.IsValid) { return; } if (!this.txtUsername.Text.Contains("@")) { lblResult.Text = "Please eneter valid email"; return; } bool success = false; SponserUser usr = null; SponserRepository sponRepos = new SponserRepository(); try { SponserUser newUser = new SponserUser(); newUser.Username = this.txtUsername.Text; newUser.Password = Encryptor.Encrypt(this.txtPass.Text); newUser.FirstName = this.txtFirst.Text; newUser.LastName = this.txtLastname.Text; newUser.Company = new Company() { ID = Int32.Parse(this.ddCompany.SelectedValue) }; newUser.Role = new Role() { ID = Int32.Parse(this.ddRole.SelectedValue) }; newUser.TerritoryCovergae_All = chkAll.Checked; if (newUser.TerritoryCovergae_All.Value) { newUser.TerritoryCovergae_BC = true; newUser.TerritoryCovergae_AB = true; newUser.TerritoryCovergae_SK = true; newUser.TerritoryCovergae_MB = true; newUser.TerritoryCovergae_ON = true; newUser.TerritoryCovergae_QC = true; newUser.TerritoryCovergae_NS = true; newUser.TerritoryCovergae_NB = true; newUser.TerritoryCovergae_NL = true; newUser.TerritoryCovergae_PEI = true; } else { newUser.TerritoryCovergae_BC = chkBC.Checked; newUser.TerritoryCovergae_AB = chkAB.Checked; newUser.TerritoryCovergae_SK = chkSK.Checked; newUser.TerritoryCovergae_MB = chkMB.Checked; newUser.TerritoryCovergae_ON = chkON.Checked; newUser.TerritoryCovergae_QC = chkQC.Checked; newUser.TerritoryCovergae_NS = chkNS.Checked; newUser.TerritoryCovergae_NB = chkNB.Checked; newUser.TerritoryCovergae_NL = chkNL.Checked; newUser.TerritoryCovergae_PEI = chkPEI.Checked; } sponRepos.Register(newUser); if (sponRepos.Authenticate(newUser.Username, newUser.Password)) { //SendHTMLEmail(newUser.Username); SendHTMLEmail(newUser.Username, newUser.FirstName, newUser.Username, Encryptor.Decrypt(newUser.Password)); //SendHTMLEmail("*****@*****.**", newUser.FirstName, newUser.Username , Encryptor.Decrypt(newUser.Password) ); usr = UserHelper.SetupUserOnLogin(newUser.Username, newUser.Password); HttpContext.Current.User = new GenericPrincipal(User.Identity, null); FormsAuthentication.SetAuthCookie(newUser.Username, false); success = true; //FormsAuthentication.RedirectFromLoginPage(newUser.Username, true); } lblResult.Text = "Registered Successfully"; } catch (Exception exc) { success = false; lblResult.Text = "Could not register : " + exc.InnerException.Message; } if (success) { Response.Redirect(UserHelper.GetURLByRole(usr)); } }