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")); }
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)); }
public ActionResult Destroy(long id) { var item = GetSession.Get <Job>(id); GetSession.Delete(item); return(RedirectToAction("Index")); }
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 })); } }
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")); }
public ActionResult ActiveForderUpload() { var item = GetSession.Get <Setting>((long)1); ViewBag.ActiveForderUpload = item.ActiveForderUpload; return(View()); }
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 })); }
public ActionResult ErrorForum(long id) { var item = GetSession.Get <Employee>(id); return(View(item)); }
public ActionResult Edit(long id) { var item = GetSession.Get <Department>(id); var model = Mapper.Map <Department, DepartmentFormModel>(item); return(View(model)); }
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/")); }
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"); } }
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")); } }
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)); }
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)); }
public ActionResult Edit(long id) { var item = GetSession.Get <PollItem>(id); var model = Mapper.Map <PollItem, PollItemFormModel>(item); return(View(model)); }
public ActionResult Destroy(long id) { var item = GetSession.Get <PollItem>(id); GetSession.Delete(item); return(RedirectToAction("Edit", "Polls", new { id = item.Poll.Id })); }
public ActionResult Edit(long id) { var item = GetSession.Get <Message>(id); var model = Mapper.Map <Message, MessageFormModel>(item); return(View(model)); }
public ContentResult PageActive(long id, bool isActive) { var item = GetSession.Get <Page>(id); item.IsActive = isActive; GetSession.Update(item); return(Content("ok")); }
public ContentResult PageOrder(long id, int pageOrder) { var item = GetSession.Get <Page>(id); item.PageOrder = pageOrder; GetSession.Update(item); return(Content("ok")); }
public ActionResult Edit(long id) { var item = GetSession.Get <Calendar>(id); var model = Mapper.Map <Calendar, CalendarFormModel>(item); return(View(model)); }
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")); }
public ContentResult bdaymailsIsAllow(bool isActive) { var model = GetSession.Get <Setting>((long)1); model.BDayEmailsAllow = isActive; GetSession.Update(model); return(Content("ok")); }
public ActionResult Edit(long id) { var item = GetSession.Get <Job>(id); var model = Mapper.Map <Job, JobFormModel>(item); return(View(model)); }
public ActionResult ForumActiveUpdate(long id, bool isActive) { ForumItem forumTarget = GetSession.Get <ForumItem>(id); forumTarget.Active = isActive; GetSession.Save(forumTarget); return(Redirect("/ForumItems/")); }
public ActionResult ForumAllowAllUpdate(long id, bool isAvailableTooAll) { ForumItem forumTarget = GetSession.Get <ForumItem>(id); forumTarget.isAvailableTooAll = isAvailableTooAll; GetSession.Save(forumTarget); return(Redirect("/ForumItems/")); }
public ActionResult UpdateTitle(long id, string newTitle) { ForumItem forumTarget = GetSession.Get <ForumItem>(id); forumTarget.Title = newTitle; GetSession.Save(forumTarget); return(Redirect("/ForumItems/")); }