Ejemplo n.º 1
0
        public ActionResult GetAllTasks(string date)
        {
            DateTime selectedDate;

            if (!DateTime.TryParse(date, out selectedDate))
            {
                selectedDate = DateTime.Now;
            }

            ViewBag.SelectedDate = selectedDate;

            //var items = GetSession.CreateQuery("from Calendar where Month(Date)=:month and Year(Date)=:year Order by date")
            //    .SetInt32("month", month)
            //    .SetInt32("year", year)
            //    .List<Calendar>();

            var items = GetSession.QueryOver <Calendar>()
                        .Where(x => x.Date == selectedDate)
                        .OrderBy(x => x.Title).Asc
                        .List();



            return(PartialView(items));
        }
Ejemplo n.º 2
0
        public ActionResult Show(string letter = "all")
        {
            string alphabet = "אבגדהוזחטיכלמנסעפצקרשת";

            //string alphabetEn = "zyxwvutsrqponmlkihgfedcba";

            ViewData["alphabet"] = alphabet;
            // ViewData["alphabetEn"] = alphabetEn;


            if (alphabet.Contains(letter))
            {
                var items = GetSession.QueryOver <Wiki>().
                            Where(x => x.Letter == letter)
                            .OrderBy(x => x.Id).Asc
                            .List();
            }

            if (letter == "all")
            {
                return(View(GetSession.QueryOver <Wiki>().List()));
            }
            else
            {
                return(View(GetSession.QueryOver <Wiki>().Where(x => x.Letter == letter).List()));

                //else
                //{
                //    return View(GetSession.QueryOver<Wiki>().Where(x => x.LetterEn == letter).List());
                //}
            }
        }
Ejemplo n.º 3
0
        public ActionResult Show(long?id)
        {
            if (id.HasValue)
            {
                var item = GetSession.QueryOver <Page>()
                           .Where(x => x.Id == id)
                           .List().FirstOrDefault();
                if (item.TypeId == 999)
                {
                    return(View(item));
                }
            }



            if (id.HasValue)
            {
                var item = GetSession.QueryOver <Page>()
                           .Where(x => x.Id == id)
                           .List()
                           .ByPermissions(HttpContext)
                           .FirstOrDefault();



                if (item == null)
                {
                    return(RedirectToAction("NoAccess"));
                }

                return(View(item));
            }
            return(RedirectToAction("NoAccess"));
        }
Ejemplo n.º 4
0
        public ActionResult Index(PageIndexModel model)
        {
            var items = GetSession.QueryOver <Page>()
                        .Where(x => x.SectionId == model.SectionId);

            if (model.ParentId.HasValue)
            {
                var item = GetSession.Get <Page>(model.ParentId);
                model.Title = item.Name;

                if (item.Parent != null)
                {
                    model.PrevParentId = item.Parent.Id;
                }

                items = items.Where(x => x.Parent == item);
            }
            else
            {
                items = items.Where(x => x.Parent == null);
            }

            model.Pages = items.OrderBy(x => x.PageOrder).Asc.List();

            return(View(model));
        }
Ejemplo n.º 5
0
        public ActionResult DepartmentResult()
        {
            var items = GetSession.QueryOver <Department>()
                        .List();

            return(View(items));
        }
Ejemplo n.º 6
0
        public ActionResult TakeOptions(long Id, PollTakeOptionsFormModel model)
        {
            Poll item = GetSession.Get <Poll>(Id);

            if (item != null)
            {
                if (ModelState.IsValid)
                {
                    CurrentPollId = Id;

                    if (model.LCID > 0)
                    {
                        Poll poll = GetSession.QueryOver <Poll>()
                                    .Where(x => x.Object != null && x.Object.Id == Id && x.LCID == model.LCID)
                                    .SingleOrDefault();

                        if (poll != null)
                        {
                            CurrentPollId = poll.Id;
                        }
                    }

                    CurrentPollDepartmentId = model.Department_id;
                    CurrentPollManagerId    = model.Manager_id;
                    CurrentPollLCID         = model.LCID;
                }

                return(RedirectToAction("TakeIntro", new { Id = CurrentPollId }));
            }
            else
            {
                return(RedirectToAction("Take", new { Id = Id }));
            }
        }
Ejemplo n.º 7
0
        public ActionResult Show(long?id)
        {
            if (id.HasValue)
            {
                var item = GetSession.QueryOver <Doc>()
                           .Where(x => x.Id == id)
                           .List()
                           .FirstOrDefault();
                if (item == null)
                {
                    return(Redirect("404.aspx"));
                }

                string currEmpUnit = GetSession.Get <Employee>(GetEmployeeId).Department.Id.ToString();

                string[] arr = item.Units.Split(',').ToArray();

                if (arr.Contains(currEmpUnit))
                {
                    return(View(item));
                }
                else
                {
                    return(Redirect("666.aspx"));
                }
            }

            return(RedirectToAction("Denied", "Docs"));
        }
Ejemplo n.º 8
0
        public JsonResult getEmps(string[] ids)
        {
            IList <Employee> list = null;


            for (int i = 0; i < ids.Length; i++)
            {
                var emps = GetSession.QueryOver <Employee>()
                           .Where(x => x.Department.Id == Convert.ToInt64(ids[0]))
                           .List();
                foreach (Employee e in emps)
                {
                    list.Add(e);
                }
            }


            //ViewBag.users = new MultiSelectList(list, "Id", "Name");
            //Session["ViewBagusers"] = ViewBag.users;


            var test = list.ToList()
                       .Select(x => new
            {
                Name  = x.FirstName,
                Phone = x.Phone,
                ID    = x.Id
            });


            return(Json(test, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 9
0
        public ActionResult List()
        {
            var items = GetSession.QueryOver <Doc>()
                        .List();

            return(View(items));
        }
Ejemplo n.º 10
0
        public ActionResult Index()
        {
            var items = GetSession.QueryOver <Job>()
                        .List();

            return(View(items));
        }
Ejemplo n.º 11
0
        public ActionResult Create()
        {
            //var myCustomerList = GetSession.QueryOver<Employee>().Select(x => x.Department.Id).List<Int64>().Distinct().ToArray();
            ViewBag.deps    = new MultiSelectList(GetSession.QueryOver <Department>().List(), "Id", "Name");
            ViewBag.depsIds = GetSession.QueryOver <Department>().Select(x => x.Id);


            // IList<Employee> empsa = (IList<Employee>)Session["ViewBagusers"];



            //if (string.IsNullOrEmpty(Session["ids"].ToString()))
            //{

            //    Debug.WriteLine(Session["ids"]);
            //    string[] ids = Session["ids"].ToString().Split(',');
            //    ViewBag.users = new MultiSelectList(GetSession.QueryOver<Employee>().List().
            //         Where(x => x.Department.Id == Convert.ToInt64(ids[0])), "Id", "FirstName");
            //}

            var units = GetSession.QueryOver <Department>()
                        .OrderBy(x => x.Name).Asc
                        .List();

            ViewBag.alex = units.ToList();


            var model = new DocFormModel();

            return(View(model));
        }
        public ActionResult List()
        {
            var items = GetSession.QueryOver <FlashBanner>()
                        .List();

            return(PartialView(items));
        }
Ejemplo n.º 13
0
        public ActionResult Create(DocFormModel model, HttpPostedFileBase upload_file, FormCollection coll)
        {
            string tt = Request.Form["upload_text"];

            if (upload_file != null)
            {
                var    uploaded_file = Guid.NewGuid();
                var    u_file        = upload_file.InputStream;
                int    index         = upload_file.FileName.IndexOf('.');
                string new_name      = uploaded_file + "." + upload_file.FileName.Substring(index + 1);

                var path = Path.Combine(Server.MapPath("~/Public/userfiles/docs"), new_name);
                upload_file.SaveAs(path);
                model.Url = new_name;
            }
            else
            {
                model.Url = Request.Form["upload_text"];
            }


            var item = Mapper.Map <DocFormModel, Doc>(model);



            if (Request.Form["userSS"] != null)
            {
                item.UsersAllowed = Request.Form["userSS"].ToString();
            }


            if (Request.Form["Units[]"] != null)
            {
                item.Units = Request.Form["Units[]"].ToString();
            }
            if (string.IsNullOrEmpty(Request.Form["Units[]"]))
            {
                item.Units = "0";
            }

            if (coll["isAvailable2All"] == "on")
            {
                item.isAvailable2All = true;
            }
            else
            {
                item.isAvailable2All = false;
            }

            item.NotSubmited = GetSession.QueryOver <Employee>().RowCount().ToString();

            item.Submited = "0";



            GetSession.Save(item);

            return(RedirectToAction("Index"));
        }
Ejemplo n.º 14
0
        public ActionResult List()
        {
            var items = GetSession.QueryOver <Wiki>()
                        .OrderBy(x => x.Id).Asc
                        .List();

            return(View(items));
        }
Ejemplo n.º 15
0
        public ActionResult JobTicker()
        {
            var items = GetSession.QueryOver <Job>()
                        .OrderBy(x => x.Id).Desc
                        .List();

            return(View(items));
        }
Ejemplo n.º 16
0
        public ActionResult Index()
        {
            var items = GetSession.QueryOver <Calendar>()
                        .OrderBy(x => x.Date).Asc
                        .List();

            return(View(items));
        }
Ejemplo n.º 17
0
        public ActionResult Archive()
        {
            var items = GetSession.QueryOver <Department>()
                        .Skip(1)
                        .List();

            return(View(items));
        }
Ejemplo n.º 18
0
        public ActionResult Edit(long id)
        {
            ViewBag.allunits = GetSession.QueryOver <Department>().List().Distinct().ToArray();
            var item = GetSession.Get <Doc>(id);

            ViewBag.alex = item.Units;

            // IList<Employee> usersList  = null;
            List <Employee> list = new List <Employee>();

            string[] ids = item.UsersAllowed.Split(',');

            if (item.UsersAllowed != "")
            {
                foreach (var empid in ids)
                {
                    var em = GetSession.Get <Employee>((long)Convert.ToUInt32(empid));
                    list.Add(em);
                }
            }



            //var ppl =
            //          GetSession.QueryOver<Employee>()
            //            .Select(x => new
            //            {
            //                EmID = x.Id,
            //                Name = string.Format("{0} {1}", x.FirstName, x.LastName)
            //            }).List();

            //ViewBag.StandID = new SelectList(ppl, "StandID", "Name");

            var stands = GetSession.QueryOver <Employee>().Where(s => s.IsActive == true).List();

            var list2 =
                from u in list
                select new SelectListItem
            {
                Value = u.Id.ToString(),
                Text  = u.FirstName + " " + u.LastName
            };


            ViewBag.users = new MultiSelectList(list2, "Value", "Text");



            ViewBag.deps = new MultiSelectList(GetSession.QueryOver <Department>().List(), "Id", "Name");


            ViewBag.docid = id;

            var model = Mapper.Map <Doc, DocFormModel>(item);

            return(View(model));
        }
Ejemplo n.º 19
0
        public ActionResult WikiBox()
        {
            var items = GetSession.QueryOver <Wiki>()
                        .Where(x => (x.Date >= DateTime.Now.Date))
                        .OrderBy(x => x.Id).Desc
                        .List();

            return(PartialView(items));
        }
Ejemplo n.º 20
0
        public ActionResult GalleriesBox()
        {
            var items = GetSession.QueryOver <Gallery>()
                        .OrderBy(x => x.Id).Desc
                        .Take(6)
                        .List();

            return(PartialView(items));
        }
        public ActionResult Index()
        {
            var items = GetSession.QueryOver <FlashBanner>()
                        .OrderBy(x => x.BannerOrder)
                        .Asc
                        .List();

            return(View(items));
        }
Ejemplo n.º 22
0
        public ActionResult Archive()
        {
            var items = GetSession.QueryOver <Poll>()
                        .OrderBy(x => x.CreatedDate)
                        .Desc
                        .Skip(1)
                        .List();

            return(View(items));
        }
Ejemplo n.º 23
0
        public ActionResult FooterMenu()
        {
            var items = GetSession.QueryOver <Page>()
                        .Where(x => x.SectionId == 3 && x.Parent == null && x.IsActive)
                        .OrderBy(x => x.PageOrder).Asc
                        .List()
                        .ByPermissions(HttpContext);

            return(PartialView(items));
        }
        public ActionResult FlashBanner()
        {
            var items = GetSession.QueryOver <FlashBanner>()
                        .Where(x => x.IsActive)
                        .OrderBy(x => x.BannerOrder)
                        .Asc
                        .List();

            return(PartialView(items));
        }
Ejemplo n.º 25
0
        public ActionResult Create()
        {
            var users = GetSession.QueryOver <Employee>().List();

            ViewBag.users = users;
            var model = new ForumItemModel();

            return(View(model));

            ViewBag.list = GetSession.QueryOver <ForumItem>().List();
        }
Ejemplo n.º 26
0
        public ActionResult ForumsBox(int categoryId = 1)
        {
            var items = GetSession.QueryOver <Forum>()
                        .Where(x => x.Parent == null && x.CategoryId == categoryId)
                        .OrderBy(x => x.CreatedDate).Desc
                        .Take(5)
                        .List();

            ViewData["catId"] = categoryId;
            return(View(items));
        }
Ejemplo n.º 27
0
 public JsonResult GetUsers(string[] ids)
 {
     return(Json(new
     {
         Users = from u in GetSession.QueryOver <Employee>().List().Where(x => x.Department.Id == Convert.ToUInt32(ids[0]))
                 select new {
             Name = u.FirstName,
             ID = u.Id,
             Lastname = u.LastName
         }
     }, JsonRequestBehavior.AllowGet));
 }
Ejemplo n.º 28
0
        public ActionResult List(string query, int categoryId = 1, int page = 1)
        {
            var items = GetSession.QueryOver <Forum>()
                        .Where(x => x.CategoryId == categoryId)
                        .OrderBy(x => x.CreatedDate)
                        .Desc
                        .List();
            var categoryTitle = "";

            try
            {
                categoryTitle = GetSession.QueryOver <Forum>()
                                .Where(x => x.CategoryId == categoryId).Take(1).SingleOrDefault().CategoryTitle;

                categoryTitle = (string.IsNullOrEmpty(categoryTitle)) ? "" : categoryTitle;
            }
            catch (Exception)
            {
                categoryTitle = "פורום חדש";
            }


            ViewData["query"]         = query;
            ViewData["categoryId"]    = categoryId;
            ViewData["categoryTitle"] = categoryTitle;
            var cats = GetSession.QueryOver <Forum>()
                       .OrderBy(x => x.CategoryId).Asc.List();

            List <string> categories = new List <string>();

            foreach (Forum forum in cats)
            {
                if (!categories.Contains(forum.CategoryId.ToString()))
                {
                    categories.Add(forum.CategoryId.ToString());
                }
            }

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

            foreach (string cat in categories)
            {
                list_categories.Add(new SelectListItem()
                {
                    Text  = cat,
                    Value = cat
                });
            }

            ViewData["categories"] = list_categories;

            return(View(items.AsPagination(page, 30)));
        }
Ejemplo n.º 29
0
        public ActionResult RightMenu(Page currentPage)
        {
            Page pageToShow = GetFirstPage(currentPage);

            var items = GetSession.QueryOver <Page>()
                        .Where(x => x.Parent.Id == pageToShow.Id)
                        .OrderBy(x => x.PageOrder).Asc
                        .List()
                        .ByPermissions(HttpContext);

            return(View(items));
        }
Ejemplo n.º 30
0
        public JsonResult GetDates()
        {
            var items = GetSession.QueryOver <Calendar>()
                        .List()
                        .Select(x => new {
                month = x.Date.Month,
                day   = x.Date.Day,
                title = x.Title
            });

            return(Json(items));
        }