Esempio n. 1
0
        private void initList(byte type = 0)
        {
            using (SrStatusFacade statfacade = new SrStatusFacade())
            {
                ViewBag.SRStateList = statfacade.GetSrState()
                                      .OrderBy(x => x.SRStateId)
                                      .Select(x => new SelectListItem()
                {
                    Value = x.SRStateId.ToString(),
                    Text  = x.SRStateName
                });
                using (SrPageFacade pageFacade = new SrPageFacade())
                {
                    ViewBag.SRPageList = pageFacade.GetSrPages()
                                         .OrderBy(x => x.SrPageName)
                                         .Select(x => new SelectListItem()
                    {
                        Value = x.SrPageId.ToString(),
                        Text  = x.SrPageName
                    });
                }
                switch (type)
                {
                case 1:
                {
                    //Create Page
                }
                break;

                default:
                {
                    //Search Page
                    ViewBag.SRStatusList = statfacade.GetSrStatus()
                                           .OrderBy(x => x.SRStatusName)
                                           .Select(x => new SelectListItem()
                        {
                            Value = x.SRStatusId.ToString(),
                            Text  = x.SRStatusName
                        });
                }
                break;
                }
            }
        }
Esempio n. 2
0
        public ActionResult SearchUserAssign(UserAssignSearchFilter searchFilter)
        {
            Logger.Info(_logMsg.Clear().SetPrefixMsg("User Monitoring :: Search UserAssign").ToInputLogString());

            try
            {
                if (ModelState.IsValid)
                {
                    searchFilter.CurrentUserId = UserInfo.UserId;

                    _userMonitoringFacade = new UserMonitoringFacade();

                    var viewModel = new SearchUserAssignViewModel();
                    viewModel.SearchFilter = searchFilter;
                    viewModel.ResultList   = _userMonitoringFacade.SearchUserAssign(searchFilter);
                    ViewBag.PageSize       = viewModel.SearchFilter.PageSize;
                    using (var stFacadce = new SrStatusFacade())
                    {
                        ViewBag.SRStateList = stFacadce.GetSrState()
                                              .Where(x => !x.SRStateId.InList(Constants.SRStateId.Cancelled, Constants.SRStateId.Closed))
                                              .ToList();
                    }

                    Logger.Info(_logMsg.Clear().SetPrefixMsg("User Monitoring :: Search UserAssign").ToSuccessLogString());
                    return(PartialView("~/Views/UserMonitoring/_SearchUserAssign.cshtml", viewModel));
                }

                return(Json(new
                {
                    Valid = false,
                    Error = string.Empty,
                    Errors = GetModelValidationErrors()
                }));
            }
            catch (Exception ex)
            {
                Logger.Error("Exception occur:\n", ex);
                Logger.Info(_logMsg.Clear().SetPrefixMsg("User Monitoring :: Search UserAssign").Add("Error Message", ex.Message).ToFailLogString());
                return(Error(new HandleErrorInfo(ex, this.ControllerContext.RouteData.Values["controller"].ToString(),
                                                 this.ControllerContext.RouteData.Values["action"].ToString())));
            }
        }