protected void ViewSiteEngineers_Click(object sender, EventArgs e) { SiteEngineerRepository engineerDataRepo = new SiteEngineerRepository(); List <SiteEngineer> siteEngineersForDisplay = engineerDataRepo.GetSiteEngineerList(); for (int i = 0; i < siteEngineersForDisplay.Count; i++) { TableRow t1 = new TableRow(); TableCell c1 = new TableCell(); TableCell c2 = new TableCell(); c1.Text = (siteEngineersForDisplay[i].SiteEngineerId).ToString(); c2.Text = siteEngineersForDisplay[i].Name; t1.Cells.Add(c1); t1.Cells.Add(c2); ReportOut.Rows.Add(t1); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (User.Identity.IsAuthenticated) { var userLogon = HttpContext.Current.User.Identity.GetUserName(); if (HttpContext.Current.User.IsInRole("Manager")) { ENETCareGlobal.CurrentUser = new ManagerRepository().GetOne(userLogon); ENETCareGlobal.CurrentUserType = UserType.SiteEngineer; Response.Redirect("~/Pages/Manager/ManagerInitialMenu.aspx"); } else if (HttpContext.Current.User.IsInRole("SiteEngineer")) { SiteEngineerRepository siteEngineerRepository = new SiteEngineerRepository(); ENETCareGlobal.CurrentUser = siteEngineerRepository.GetOne(userLogon); ENETCareGlobal.CurrentUserType = UserType.SiteEngineer; Response.Redirect("~/Pages/Engineer/EnginnerInitialMenu.aspx"); } else if (HttpContext.Current.User.IsInRole("Accountant")) { Response.Redirect("~/Pages/Accountant/AccountantInitialMenu.aspx"); } else { throw new Exception("Error selecting user type"); } } else { LoginForm.Visible = true; } } }