コード例 #1
0
        public ActionResult Index(FormCollection us)
        {
            var st = us.GetKey(1);

            FC = us;
            if (st.CompareTo("Create") != 0)
            {
                var client = new MvcUniJudje.WebReference.ServiceForAdmin();
                MvcUniJudje.WebReference.UserDTO[] UDTO = client.GetUsers(Session["session_key"].ToString());
                int ij = 0;
                for (int i = 0, j = 0; i < UDTO.Count() & j < 100; i++, j++)
                {
                    var s = FC[(UDTO[i].Id.ToString())].Remove(2);
                    if (s.Equals("tr"))
                    {
                        ij++;
                    }
                }
                if (ij == 0)
                {
                    ModelState.AddModelError("Create", "Не выбраны пользователи.");
                }

                if (ModelState.IsValid)
                {
                    return(RedirectToAction(st));
                }
                return(View(Enumerable.Range(0, UDTO.Length).Select(i => new User {
                    ID = UDTO[i].Id, Name = UDTO[i].Name, Login = UDTO[i].Login, Locking = (UDTO[i].BlockedTo != null ? true : false), Date = UDTO[i].BlockedTo, DateRegistration = UDTO[i].DateRegistration
                })));
            }
            return(RedirectToAction(st));
        }
コード例 #2
0
        //
        // GET: /User/

        //   [OutputCache(Location = System.Web.UI.OutputCacheLocation.Any, Duration = 60)]
        public ActionResult Index()
        {
            ValidationIn val = new ValidationIn();

            if (val.Validation("Пользователи", Session["session_key"].ToString(), Session["name"].ToString()))
            {
                var client = new MvcUniJudje.WebReference.ServiceForAdmin();
                MvcUniJudje.WebReference.UserDTO[] UDTO = client.GetUsers(Session["session_key"].ToString());

                return(View(Enumerable.Range(0, UDTO.Length).Select(i => new User {
                    ID = UDTO[i].Id, Name = UDTO[i].Name, Login = UDTO[i].Login, Locking = (UDTO[i].BlockedTo != null ? true : false), Date = UDTO[i].BlockedTo, DateRegistration = UDTO[i].DateRegistration
                })));
            }
            return(RedirectToAction("Index", "Home"));
        }
コード例 #3
0
 public ActionResult Group()
 {
     using (var client = new MvcUniJudje.WebReference.ServiceForAdmin())
     {
         MvcUniJudje.WebReference.UserDTO[] UDTO = client.GetUsers(Session["session_key"].ToString());
         List <int> checkBox = new List <int>();
         List <WebReference.UserDTO> user = new List <WebReference.UserDTO>();
         for (int i = 0, j = 0; i < UDTO.Count() & j < 100; i++, j++)
         {
             var s = FC[(UDTO[i].Id.ToString())].Remove(2);
             if (s.Equals("tr"))
             {
                 checkBox.Add(UDTO[i].Id);
                 user.Add((from c in UDTO
                           where c.Id == UDTO[i].Id
                           select new WebReference.UserDTO {
                     Id = c.Id, Login = c.Login, DateRegistration = c.DateRegistration, Name = c.Name
                 }).FirstOrDefault());
             }
         }
         return(View(user));
     }
 }