public ActionResult CategoryCreate()
 {
     var user = db.dt_user.FirstOrDefault();
     if (Session["personel_id"] == null)
         return RedirectToAction("Default", "Home");
     else
     {
         int personel_id = Convert.ToInt32(Session["personel_id"]);
         user = db.dt_user.Where(a => a.state == 1 && a.ID == personel_id).FirstOrDefault();
         if (user == null)
             return RedirectToAction("Default", "Home");
         ViewBag.userName = user.name + " " + user.surname;
     }
     List<SelectListItem> listCategory = new SelectList(db.dt_category.ToList().Where(a => a.state == 1 && a.company_id == user.company_id), "ID", "name").ToList<SelectListItem>();
     SelectListItem it = new SelectListItem();
     it.Text = "Üst Kategori";
     it.Value = "0";
     listCategory.Add(it);
     ViewBag.upCategoryID = listCategory.ToList();
     return View();
 }
Ejemplo n.º 2
0
        public ActionResult _EditSearchedTerms(long id, string term, string searchTypeCode)
        {
            IEnumerable<ISearcher> searchers = SearcherFactory.GetDisplaySearchers();
            if (searchers != null)
            {
                List<SelectListItem> itemList = new SelectList(searchers.Select(n => new { text = n.Name, value = n.Code }), "value", "text", searchTypeCode).ToList();
                bool selectedGlobal = false;
                if (searchTypeCode == SearcherFactory.GlobalSearchCode)
                {
                    selectedGlobal = true;
                }
                itemList.Add(new SelectListItem { Text = SearcherFactory.GlobalSearchName, Value = SearcherFactory.GlobalSearchCode, Selected = selectedGlobal });
                ViewData["searchList"] = itemList;
            }

            ViewData["id"] = id;

            return View();
        }
        public ActionResult DownloadReports()
        {
            var data = db.TeamReports.DistinctBy(t => t.Round);

            var i = new SelectList(data, "Round", "Round").ToList();
            i.Add(new SelectListItem { Text = "全部报告", Value = "" });
            ViewBag.List = i;

            return View();
        }
 public ActionResult CategoryCreate(int? Id, int? mesaj)
 {
     if (Session["user_id"] == null)
         return RedirectToAction("Default", "Home");
     int user_id = Convert.ToInt32(Session["user_id"].ToString());
     var u = db.dt_user.Where(a => a.state == 1 && a.ID == user_id).FirstOrDefault();
     if (u == null)
         return RedirectToAction("Default", "Home");
     ViewBag.userName = u.name + " " + u.surname;
     if (mesaj != null)
         TempData["mesaj"] = mesaj.ToString();
     int companyId;
     if (Id == null)
         companyId = 0;
     else
         companyId = (int)Id;
     List<SelectListItem> list = TumSirket(companyId);
     int companyid;
     if (Id == null)
         companyid = Convert.ToInt32(list.ToList().First().Value);
     else
         companyid = companyId;
     List<SelectListItem> listCategory = new SelectList(db.dt_category.ToList().Where(a => a.state == 1 && a.company_id == companyid), "ID", "name").ToList<SelectListItem>();
     SelectListItem it = new SelectListItem();
     it.Text = "Üst Kategori";
     it.Value = "0";
     listCategory.Add(it);
     ViewBag.company_id = list.ToList();
     ViewBag.upCategoryID = listCategory.ToList();
     return View();
 }
 public void SirketGoster(int Id, int parentId)
 {
     List<SelectListItem> list = new SelectList(db.dt_company.ToList().Where(a => a.active == 1 && a.ID != Id && a.parentID != Id), "ID", "companyname", parentId).ToList<SelectListItem>();
     SelectListItem it = new SelectListItem();
     it.Text = "Merkezi Şirket";
     it.Value = "0";
     list.Add(it);
     if (parentId == 0)
         list.Reverse();
     ViewBag.companyId = list.ToList();
 }
 public void SirketGoster()
 {
     List<SelectListItem> list = new SelectList(db.dt_company.ToList().Where(a => a.active == 1), "ID", "companyname").ToList<SelectListItem>();
     SelectListItem it = new SelectListItem();
     it.Text = "Merkezi Şirket";
     it.Value = "0";
     list.Add(it);
     ViewBag.companyId = list.ToList();
 }
Ejemplo n.º 7
0
        // GET: Curso/EditarAsignacion/5
        public ActionResult EditarAsignacion(int? id)
        {
            if (Request.UrlReferrer != null)
            {
                ViewBag.returnUrl = Request.UrlReferrer.ToString();
            }
            else
            {
                ViewBag.returnUrl = null;
            }
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            Group grupo = db.Groups.Find(id);
            if (grupo == null)
            {
                return HttpNotFound();
            }

            /* Se obtiene la lista de profesores */
            List<SelectListItem> vSelectList = new SelectList(db.Professors.OrderBy(p => p.Name), "ID", "Name").ToList();
            SelectListItem selListItem = new SelectListItem() { Value = "0", Text = "Sin asignar" };
            vSelectList.Add(selListItem);

            ViewBag.Profesores = vSelectList;
            return View(grupo);
        }