Пример #1
0
        private void btnIniciar_Click(object sender, EventArgs e)
        {
            CFilosofo.finalizado = false;

            if (!cBoxRegistro.Checked)
            {
                txtRegistro = null;
            }

            CForm form = new CForm(
                label_Filo01, label_Filo02,
                label_Filo03, label_Filo04,
                label_Filo05, label_Pal01,
                label_Pal02, label_Pal03,
                label_Pal04, label_Pal05,
                txtRegistro, txtConteo01,
                txtConteo02, txtConteo03,
                txtConteo04, txtConteo05);

            CPrincipal principal = new CPrincipal(form);

            this.btnDetener.Enabled   = true;
            this.btnIniciar.Enabled   = false;
            this.cBoxRegistro.Enabled = false;
        }
Пример #2
0
        public IEnumerable <Role> GetAllRoles()
        {
            CPrincipal usr = new CPrincipal(HttpContext.Current.User.Identity);

            if (usr.AccessLevel == AccessLevel.SystemAdmin)
            {
                return(Roles.ToList());
            }
            else
            {
                return(Roles.Where(x => x.strength != 100));
            }
        }
Пример #3
0
        //
        // GET: /ChildAbduction/Create

        public ActionResult Create()
        {
            ViewBag.protectiveMarkingList        = new SelectList(db.ProtectiveMarkings.Where(x => x.active == true).ToList(), "protectiveMarkingID", "Detail");
            ViewBag.childAbductionCaseStatusList = new SelectList(db.CaseStatuses.Where(x => x.active == true).OrderBy(x => x.sequence), "caseStatusID", "Detail");
            ViewBag.caOrderTypeID = new SelectList(db.CAOrderTypes.Where(x => x.active == true), "caOrderTypeID", "Detail");
            ChildAbduction model = new ChildAbduction();

            model.nextReviewDate = DateTime.Today.AddMonths(1);
            System.Security.Principal.IIdentity userIdentity = User.Identity;
            Tipstaff.CPrincipal thisUser = new CPrincipal(userIdentity);
            model.createdBy = thisUser.User.DisplayName;
            return(View(model));
        }
    protected override bool AuthorizeCore(HttpContextBase httpContext)
    {
        bool authorized = base.AuthorizeCore(httpContext);

        if (!authorized)
        {
            return(false);
        }
        IIdentity  user       = httpContext.User.Identity;
        CPrincipal cPrincipal = new CPrincipal(user);

        httpContext.User = cPrincipal;
        return(true);
    }
Пример #5
0
 public ActionResult Index()
 {
     System.Security.Principal.IIdentity userIdentity = User.Identity;
     Tipstaff.CPrincipal thisUser = new CPrincipal(userIdentity);
     if (thisUser.IsInRole("Admin"))
     {
         var faqs = db.FAQs;
         return(View(faqs.ToList()));
     }
     else
     {
         var faqs = db.FAQs.Where(f => f.loggedInUser == User.Identity.IsAuthenticated);
         return(View(faqs.ToList()));
     }
 }
        //
        // GET: /Warrant/Create
        public ActionResult Create()
        {
            ViewBag.protectiveMarkings = new SelectList(db.ProtectiveMarkings.Where(x => x.active == true), "protectiveMarkingID", "Detail");
            ViewBag.divisions          = new SelectList(db.Divisions.Where(x => x.active == true), "divisionID", "Detail");
            ViewBag.resultID           = new SelectList(db.Results.Where(x => x.active == true), "resultID", "Detail");
            ViewBag.caseStatusID       = new SelectList(db.CaseStatuses.Where(x => x.active == true), "caseStatusID", "Detail");
            Warrant model = new Warrant();

            model.nextReviewDate = DateTime.Today.AddMonths(1);
            System.Security.Principal.IIdentity userIdentity = User.Identity;
            Tipstaff.CPrincipal thisUser = new CPrincipal(userIdentity);
            model.createdBy    = thisUser.User.DisplayName;
            model.caseStatusID = 1;
            return(View(model));
        }