Esempio n. 1
0
        public void GetSessionHasToReturnSessionIfItExists()
        {
            var session = new Session(Guid.NewGuid().ToString());

            A.CallTo(() => _readSessionRepository.GetSession(A <string> ._)).Returns(session);

            var result = _command.Get(Guid.NewGuid().ToString());

            Assert.True(session.SessionId == result.SessionId);
            Assert.True(session.PlayerId == result.PlayerId);
        }
        public ActionResult Destroy(Guid id)
        {
            var item = GetSession.Get <Gallery>(id);

            GetSession.Delete(item);
            return(RedirectToAction("Index"));
        }
Esempio n. 3
0
        public ActionResult Create(PollFormModel model)
        {
            if (ModelState.IsValid)
            {
                var item = Mapper.Map <PollFormModel, Poll>(model);


                // Object
                if (model.Object_id > 0)
                {
                    item.Object = GetSession.Get <Poll>(model.Object_id);
                }
                else
                {
                    item.Object = null;
                }

                // Anonymous User
                if (model.AnonymousUser_id > 0)
                {
                    item.AnonymousUser = GetSession.Get <Employee>(model.AnonymousUser_id);
                }
                else
                {
                    item.AnonymousUser = null;
                }


                GetSession.Save(item);

                return(RedirectToAction("edit", new { id = item.Id }));
            }

            return(View(model));
        }
Esempio n. 4
0
        public ActionResult Destroy(long id)
        {
            var item = GetSession.Get <Job>(id);

            GetSession.Delete(item);
            return(RedirectToAction("Index"));
        }
Esempio n. 5
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 }));
            }
        }
Esempio n. 6
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"));
        }
Esempio n. 7
0
        public ActionResult ActiveForderUpload()
        {
            var item = GetSession.Get <Setting>((long)1);

            ViewBag.ActiveForderUpload = item.ActiveForderUpload;
            return(View());
        }
Esempio n. 8
0
        public ActionResult SendBdayMessage()
        {
            var items = GetBdayEmployees();

            foreach (var item in items)
            {
                var sentCount = 0;
                var manager   = GetSession.Get <Employee>(Convert.ToInt64(item.Manager));
                while (manager != null && sentCount < 2)
                {
                    if (manager.Email.Contains("@"))
                    {
                        new NotificationsController().Bday(manager, item).Deliver();
                        sentCount++;
                        Response.Write(manager.Email + ";");
                    }
                    else
                    {
                        Response.Write(manager.Id + ";");
                    }
                    manager = GetSession.Get <Employee>(manager.Manager);
                }
                Response.Write("\n");
            }

            return(Content("sent"));
        }
        public ActionResult DestroyMessage(long id, long categoryId)
        {
            var item = GetSession.Get <Forum>(id);

            GetSession.Delete(item);
            return(RedirectToAction("List", new { categoryId }));
        }
Esempio n. 10
0
        public ActionResult ErrorForum(long id)
        {
            var item = GetSession.Get <Employee>(id);


            return(View(item));
        }
Esempio n. 11
0
        public ActionResult Edit(long id)
        {
            var item  = GetSession.Get <Department>(id);
            var model = Mapper.Map <Department, DepartmentFormModel>(item);

            return(View(model));
        }
Esempio n. 12
0
        public ActionResult Update(ForumItemModel model)
        {
            ForumItem forumTarget = GetSession.Get <ForumItem>(Convert.ToInt64(Request.Form["Id"]));

            forumTarget.Admin  = GetSession.Get <Employee>(Convert.ToInt64(Request.Form["Admin"]));
            forumTarget.Title  = Request.Form["Title"];
            forumTarget.Active = (Request.Form["Active"] == "on") ? true : false;

            GetSession.Update(forumTarget);


            #region ADO.NET
            //string theTitle = Request.Form["Title"];
            //long theAdmin = Convert.ToInt32(Request.Form["Admin"]);
            //long theId = Convert.ToInt32(Request.Form["Id"]);
            //bool theActive = (Request.Form["Active"] == "on") ? true : false;
            //SqlConnection sqlConnection1 = new SqlConnection(cs);
            //SqlCommand cmd = new SqlCommand();
            //Int32 rowsAffected;
            //cmd.CommandText = "UPDATE portal_ForumItem SET Title = '" + theTitle + "', Admin_id = " + theAdmin + ", Active = '" + theActive + "' WHERE Id = " + theId + "";
            ////cmd.CommandText = "UPDATE portal_ForumItem SET Title = '" + theTitle + "', Admin_id = " + theAdmin + ", Active = '" + theActive + "' WHERE Id = "+theId+"";
            //cmd.CommandType = CommandType.Text;
            //cmd.Connection = sqlConnection1;
            //sqlConnection1.Open();
            //rowsAffected = cmd.ExecuteNonQuery();
            //sqlConnection1.Close();

            #endregion

            return(Redirect("/ForumItems/"));
        }
Esempio n. 13
0
        public string UpdateManagers(Dictionary <string, string> user_manager)
        {
            Employee temp = new Employee();

            try
            {
                foreach (var listitem in user_manager)
                {
                    if (!string.IsNullOrEmpty(listitem.Key) && !string.IsNullOrEmpty(listitem.Value.Trim()))
                    {
                        var item  = GetSession.Get <Employee>(Convert.ToInt64(listitem.Key));
                        var item2 = GetSession.Get <Employee>(Convert.ToInt64(listitem.Value));

                        if (item != null)
                        {
                            item.Manager = item2;
                            GetSession.Update(item);
                        }
                    }
                }
                return("yes");
            }
            catch (Exception)
            {
                return("no");
            }
        }
Esempio n. 14
0
        public ActionResult Take(Int64 id)
        {
            Poll item = GetSession.Get <Poll>(id);

            if (item != null)
            {
                bool answered = item.PollItems.Any(pi => pi.EmployeePollItems.Any(epi => epi.Employee.Id == Portal.Helpers.EmployeesHelper.GetCurrentEmployee().Id));

                if (answered && !item.UserEditable && !(item.AnonymousUser != null && item.AnonymousUser.Id == EmployeesHelper.GetCurrentEmployee().Id))
                {
                    item.ReadOnly = true;
                }

                if (this.CurrentPollId == id)
                {
                    return(View(new PollTakeFormModel()
                    {
                        Poll = item,
                        IsRightToLeft = CurrentPollLCID.HasValue ? CultureHelper.IsRightToLeft(CurrentPollLCID.Value) : true
                    }));
                }
                else
                {
                    return(RedirectToAction("TakeOptions", new { Id = id }));
                }
            }
            else
            {
                return(RedirectToAction("Index"));
            }
        }
Esempio n. 15
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));
        }
Esempio n. 16
0
        public ActionResult Edit(long id)
        {
            var item = GetSession.Get <StreamLink>(id);

            var model = Mapper.Map <StreamLink, StreamLinkFormModel>(item);

            return(View(model));
        }
        public ActionResult Edit(Guid id)
        {
            var item = GetSession.Get <Gallery>(id);

            var model = Mapper.Map <Gallery, GalleryFormModel>(item);

            return(View(model));
        }
Esempio n. 18
0
        public ActionResult Edit(long id)
        {
            var item = GetSession.Get <PollItem>(id);

            var model = Mapper.Map <PollItem, PollItemFormModel>(item);

            return(View(model));
        }
Esempio n. 19
0
        public ActionResult Destroy(long id)
        {
            var item = GetSession.Get <PollItem>(id);

            GetSession.Delete(item);

            return(RedirectToAction("Edit", "Polls", new { id = item.Poll.Id }));
        }
Esempio n. 20
0
        public ActionResult Edit(long id)
        {
            var item = GetSession.Get <Message>(id);

            var model = Mapper.Map <Message, MessageFormModel>(item);

            return(View(model));
        }
Esempio n. 21
0
        public ContentResult PageActive(long id, bool isActive)
        {
            var item = GetSession.Get <Page>(id);

            item.IsActive = isActive;
            GetSession.Update(item);
            return(Content("ok"));
        }
Esempio n. 22
0
        public ContentResult PageOrder(long id, int pageOrder)
        {
            var item = GetSession.Get <Page>(id);

            item.PageOrder = pageOrder;
            GetSession.Update(item);
            return(Content("ok"));
        }
Esempio n. 23
0
        public ActionResult Edit(long id)
        {
            var item = GetSession.Get <Calendar>(id);

            var model = Mapper.Map <Calendar, CalendarFormModel>(item);

            return(View(model));
        }
Esempio n. 24
0
        public ActionResult ActiveForderUploadActive(bool isActive)
        {
            var item = GetSession.Get <Setting>((long)1);

            item.ActiveForderUpload = isActive;
            GetSession.Update(item);
            return(Content("ok"));
        }
        public ContentResult FlashBannerActive(long id, bool isActive)
        {
            var item = GetSession.Get <FlashBanner>(id);

            item.IsActive = isActive;
            GetSession.Update(item);
            return(Content("ok"));
        }
Esempio n. 26
0
        public ContentResult bdaymailsIsAllow(bool isActive)
        {
            var model = GetSession.Get <Setting>((long)1);

            model.BDayEmailsAllow = isActive;
            GetSession.Update(model);
            return(Content("ok"));
        }
Esempio n. 27
0
        public ActionResult Edit(long id)
        {
            var item = GetSession.Get <Job>(id);

            var model = Mapper.Map <Job, JobFormModel>(item);

            return(View(model));
        }
Esempio n. 28
0
        public ActionResult ForumActiveUpdate(long id, bool isActive)
        {
            ForumItem forumTarget = GetSession.Get <ForumItem>(id);

            forumTarget.Active = isActive;

            GetSession.Save(forumTarget);
            return(Redirect("/ForumItems/"));
        }
Esempio n. 29
0
        public ActionResult ForumAllowAllUpdate(long id, bool isAvailableTooAll)
        {
            ForumItem forumTarget = GetSession.Get <ForumItem>(id);

            forumTarget.isAvailableTooAll = isAvailableTooAll;

            GetSession.Save(forumTarget);
            return(Redirect("/ForumItems/"));
        }
Esempio n. 30
0
        public ActionResult UpdateTitle(long id, string newTitle)
        {
            ForumItem forumTarget = GetSession.Get <ForumItem>(id);

            forumTarget.Title = newTitle;

            GetSession.Save(forumTarget);
            return(Redirect("/ForumItems/"));
        }