public string FindApplication() { IEnumerable <Application> entityList = null; int pageCount = 1; int totalCount = 0; try { string page = Request["pageIndex"]; int pageIndex = int.Parse(page); ApplicationBusinessService applicationBusinessService = new ApplicationBusinessService(); Expression <Func <Application, bool> > expression = t => t.IsEnabled; totalCount = applicationBusinessService.GetPagedCount(new DirectSpecification <Application>(expression)); int pageSize = 4; if (totalCount > 0) { pageCount = totalCount % pageSize == 0 ? totalCount / pageSize : totalCount / pageSize + 1; Expression <Func <Application, DateTime> > order = t => t.CreateTime; entityList = applicationBusinessService.GetPagedElements <DateTime>(pageIndex, new DirectSpecification <Application>(expression), order, false, pageSize); } } catch (Exception ex) { LogHelper.WriteErrorLog(ex); } return(SerializeHelper.JSONSerialize(new { entities = entityList, pageCount = pageCount, totalCount = totalCount })); }
public ActionResult NewApplication() { bool result; try { string projectName = Request["projectName"]; string description = Request["description"]; if (projectName.Trim() == "") { projectName = "undefound"; } if (description.Trim() == "") { description = "undefound"; } ApplicationBusinessService applicationBusinessService = new ApplicationBusinessService(); applicationBusinessService.Insert(new Application() { Id = Guid.NewGuid().ToString("N").ToLower(), Description = description, ProjectName = projectName, UserId = Os_User.Id }); result = true; } catch (Exception ex) { LogHelper.WriteErrorLog(ex); result = false; } return(Content(result.ToString())); }
// GET: Document public ActionResult Index() { string applicationId = Request.QueryString["pcode"]; string doecumentId = Request.QueryString["code"]; if (applicationId == null && string.IsNullOrEmpty(applicationId)) { return(Redirect("../Home")); } if (doecumentId == null && string.IsNullOrEmpty(doecumentId)) { doecumentId = "null"; } else { } ApplicationBusinessService applicationBusinessService = new ApplicationBusinessService(); Application application = applicationBusinessService.FirstOrDefault(new DirectSpecification <Application>(t => t.IsEnabled && t.Id == applicationId)); if (application == null) { return(Redirect("../Home")); } ViewData["pcode"] = applicationId; ViewData["code"] = doecumentId; ViewData["projectName"] = application.ProjectName; return(View()); }