コード例 #1
0
        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);
            }
        }
コード例 #2
0
ファイル: Login.aspx.cs プロジェクト: NSNeil/.NETAssignments
        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;
                }
            }
        }