Exemplo n.º 1
0
        public ActionResult Types(int type = -1)
        {
            var            types = clnt.GetWorkerTypes();
            TypeConstrains typeConstrains;

            List <SelectListItem> items = new List <SelectListItem>();

            if (types != null && types.Count > 0)
            {
                foreach (var t in types)
                {
                    items.Add(new SelectListItem()
                    {
                        Text     = t.TypeName,
                        Value    = string.Format("{0}", t.TypeID),
                        Selected = false
                    });
                }

                var selected = items.Find(x => int.Parse(x.Value) == type);
                if (selected != null)
                {
                    selected.Selected = true;
                }
                else if (items.Count > 0)
                {
                    items[0].Selected = true;
                }

                //TODO: get type constrains
                typeConstrains = new TypeConstrains();
            }
            else
            {
                typeConstrains = new TypeConstrains();
            }

            ViewData["Types"]             = items;
            ViewData["NextWeekStartDate"] = clnt.GetWeekStartDate();

            return(View(typeConstrains));
        }
Exemplo n.º 2
0
 public ActionResult SetTypeConstrains(TypeConstrains type)
 {
     return(RedirectToAction("Types", "Account", new { type = type.TypeId }));
 }