private static void FillDetailsOfLoggedInUser(IUserDTO loginResult, UserInfo userInfo) { FormsAuthentication.SetAuthCookie(loginResult.EmployeeDTO.Email, false); DTOConverter.FillViewModelFromDTO(userInfo, loginResult); userInfo.Employee = new EmployeeInfo(); DTOConverter.FillViewModelFromDTO(userInfo.Employee, loginResult.EmployeeDTO); }
public ActionResult GetCurrentNotices() { ActionResult retVal = null; INoticeFacade noticeFacade = (INoticeFacade)FacadeFactory.Instance.Create(FacadeType.NoticeManagerFacade); OperationResult <IList <INoticeDTO> > result = noticeFacade.GetCurrentNotices(); IList <NoticeModel> noticeModelList = null; if (result.IsValid()) { noticeModelList = new List <NoticeModel>(); NoticeModel noticeModel = null; foreach (INoticeDTO noticeDTO in result.Data) { noticeModel = new NoticeModel(); DTOConverter.FillViewModelFromDTO(noticeModel, noticeDTO); noticeModel.NotifierEmployeeName = noticeDTO.PostedByEmployee.FirstName + " " + noticeDTO.PostedByEmployee.LastName; noticeModelList.Add(noticeModel); } retVal = View("~/Views/Notice/GetNotices.cshtml", noticeModelList); } else if (result.HasFailed()) { retVal = RedirectToAction("Index", "Notice"); } else { retVal = View("~/Views/Shared/Error.cshtml"); } return(retVal); }
public ActionResult NoticeDetails(int noticeId) { ActionResult retVal = null; INoticeFacade noticeFacade = (INoticeFacade)FacadeFactory.Instance.Create(FacadeType.NoticeManagerFacade); OperationResult <INoticeDTO> result = noticeFacade.GetNotice(noticeId); if (result.IsValid()) { NoticeModel notice = new NoticeModel(); DTOConverter.FillViewModelFromDTO(notice, result.Data); notice.NotifierEmployeeName = result.Data.PostedByEmployee.FirstName + " " + result.Data.PostedByEmployee.LastName; retVal = PartialView("~/Views/Notice/_NoticeDetails.cshtml", notice); } else if (result.HasFailed()) { retVal = RedirectToAction("GetActiveNotices", "Notice"); } else { retVal = View("~/Views/Shared/Error.cshtml"); } return(retVal); }
public ActionResult EditNotice(int noticeId) { ActionResult retVal = null; INoticeFacade noticeFacade = (INoticeFacade)FacadeFactory.Instance.Create(FacadeType.NoticeManagerFacade); OperationResult <INoticeDTO> result = noticeFacade.GetNotice(noticeId); if (result.IsValid()) { NoticeModel notice = new NoticeModel(); DTOConverter.FillViewModelFromDTO(notice, result.Data); ViewBag.Create = false; retVal = PartialView("~/Views/Notice/_EditNotice.cshtml", notice); } else if (result.HasFailed()) { retVal = RedirectToAction("GetActiveNotices", "Notice"); } else { retVal = View("~/Views/Shared/Error.cshtml"); } return(retVal); }