public ActionResult Index() { return(ActionResultHelper.TryCatchWithLogger(() => { PreservationVerifyIndexModel model = new PreservationVerifyIndexModel(); CustomerCompanyViewModel customerCompany = Session["idCompany"] as CustomerCompanyViewModel; if (WCFUtility.GetSettingValue("DBAdminLoginConnection") == "false") { DocumentCondition conditions = new DocumentCondition(); List <DocumentSortCondition> sortConditions = new List <DocumentSortCondition>(); conditions.DocumentAttributeConditions = new System.ComponentModel.BindingList <DocumentCondition>(); conditions.DocumentAttributeConditions.Add(new DocumentCondition() { Name = "IsLegal", Value = 1, Operator = Library.Common.Enums.DocumentConditionFilterOperator.IsEqualTo, Condition = Library.Common.Enums.DocumentConditionFilterCondition.And }); sortConditions.Add(new DocumentSortCondition { Name = "Name", Dir = "ASC" }); model.archives = ArchiveService.GetArchives(0, int.MaxValue, conditions, sortConditions, out int total, customerCompany.CompanyId).ToList(); } else { model.archives = UserArchive.GetUserArchivesPaged(User.Identity.Name, 0, int.MaxValue, out int total, customerCompany.CompanyId); } return View(model); }, _loggerService)); }
public ActionResult GetPreservationPendingTask([DataSourceRequest] DataSourceRequest request) { DataSourceResult result = new DataSourceResult(); CustomerCompanyViewModel customerCompany = Session["idCompany"] as CustomerCompanyViewModel; ICollection <PreservationTask> items = new List <PreservationTask>(); try { BindingList <DocumentArchive> archives = null; if (WCFUtility.GetSettingValue("DBAdminLoginConnection") == "false") { archives = new BindingList <DocumentArchive>(ArchiveService.GetLegalArchives("", customerCompany.CompanyId).Select(x => x.Archive).ToList()); } else { archives = CustomerService.GetCustomerArchivesByUsername(User.Identity.Name); } items = _preservationService.GetPreservationActiveTasks(archives.Select(s => s.IdArchive).ToList()); result.Total = items.Count; result.Data = items; } catch (Exception ex) { result.Errors = ex; } return(Json(result, JsonRequestBehavior.AllowGet)); }
public ActionResult GetPreservationVerifyTask([DataSourceRequest] DataSourceRequest request) { DataSourceResult result = new DataSourceResult(); CustomerCompanyViewModel customerCompany = Session["idCompany"] as CustomerCompanyViewModel; BindingList <DocumentArchive> archives = new BindingList <DocumentArchive>(); try { if (WCFUtility.GetSettingValue("DBAdminLoginConnection") == "false") { archives = CustomerService.GetCustomerArchivesByUsername(User.Identity.Name); } else { archives = new BindingList <DocumentArchive>(ArchiveService.GetLegalArchives("", customerCompany.CompanyId).Select(x => x.Archive).ToList()); } var tasks = new PreservationService().GetPreservationVerify(archives.Select(x => x.IdArchive).ToArray(), true); result.Total = tasks.Count; result.Data = tasks; } catch (Exception ex) { result.Errors = ex; } return(Json(result, JsonRequestBehavior.AllowGet)); }
public ActionResult GridArchives([DataSourceRequest] DataSourceRequest request) { var result = new DataSourceResult(); try { int total = 0; int skip = request.Page - 1; int take = request.PageSize; skip = (skip < 1) ? 0 : skip * take; CustomerCompanyViewModel customerCompany = Session["idCompany"] as CustomerCompanyViewModel; if (WCFUtility.GetSettingValue("DBAdminLoginConnection") == "false") { DocumentCondition conditions = new DocumentCondition(); List <DocumentSortCondition> sortConditions = new List <DocumentSortCondition>(); conditions.DocumentAttributeConditions = new System.ComponentModel.BindingList <DocumentCondition>(); conditions.DocumentAttributeConditions.Add(new DocumentCondition() { Name = "IsLegal", Value = 1, Operator = Library.Common.Enums.DocumentConditionFilterOperator.IsEqualTo, Condition = Library.Common.Enums.DocumentConditionFilterCondition.And }); if (request.Filters != null) { foreach (var item in request.Filters) { //conditions.DocumentAttributeConditions.Add(new DocumentCondition { Name = item., Value = item.Value, Operator = Library.Common.Enums.DocumentConditionFilterOperator.Contains, Condition = Library.Common.Enums.DocumentConditionFilterCondition.And }); } } if (request.Sorts != null) { foreach (var item in request.Sorts) { sortConditions.Add(new DocumentSortCondition { Name = item.Member, Dir = item.SortDirection }); } } else { sortConditions.Add(new DocumentSortCondition { Name = "Name", Dir = "ASC" }); } result.Data = ArchiveService.GetArchives(skip, take, conditions, sortConditions, out total, customerCompany.CompanyId).ToList(); } else { result.Data = UserArchive.GetUserArchivesPaged(User.Identity.Name, skip, take, out total, customerCompany.CompanyId); } result.Total = total; } catch (Exception ex) { result.Errors = ex; } return(Json(result, JsonRequestBehavior.AllowGet)); }
public ActionResult GridPreservationVerify([DataSourceRequest] DataSourceRequest request) { var result = new DataSourceResult(); try { int total = 0; int skip = (request.Page - 1) * request.PageSize; int take = request.PageSize; if (skip < 0) { skip = 0; } var service = new PreservationService(); const int ARCHIVES_TAKE = 5; int archiveSkip = 0, totalArchives; List <DocumentArchive> archivi = null; CustomerCompanyViewModel customerCompany = Session["idCompany"] as CustomerCompanyViewModel; if (WCFUtility.GetSettingValue("DBAdminLoginConnection") == "false") { DocumentCondition conditions = new DocumentCondition(); List <DocumentSortCondition> sortConditions = new List <DocumentSortCondition>(); conditions.DocumentAttributeConditions = new System.ComponentModel.BindingList <DocumentCondition>(); conditions.DocumentAttributeConditions.Add(new DocumentCondition() { Name = "IsLegal", Value = 1, Operator = Library.Common.Enums.DocumentConditionFilterOperator.IsEqualTo, Condition = Library.Common.Enums.DocumentConditionFilterCondition.And }); if (request.Filters != null) { foreach (var item in request.Filters) { //conditions.DocumentAttributeConditions.Add(new DocumentCondition { Name = item., Value = item.Value, Operator = Library.Common.Enums.DocumentConditionFilterOperator.Contains, Condition = Library.Common.Enums.DocumentConditionFilterCondition.And }); } } if (request.Sorts != null) { foreach (var item in request.Sorts) { sortConditions.Add(new DocumentSortCondition { Name = item.Member, Dir = item.SortDirection }); } } else { sortConditions.Add(new DocumentSortCondition { Name = "Name", Dir = "ASC" }); } archivi = ArchiveService.GetArchives(skip, take, conditions, sortConditions, out total, customerCompany.CompanyId).ToList(); } else { archivi = UserArchive.GetUserArchivesPaged(User.Identity.Name, archiveSkip, ARCHIVES_TAKE, out totalArchives, customerCompany.CompanyId); if (archivi.Count < totalArchives) { for (archiveSkip += ARCHIVES_TAKE; archiveSkip < totalArchives; archiveSkip += ARCHIVES_TAKE) { archivi.AddRange(UserArchive.GetUserArchivesPaged(User.Identity.Name, archiveSkip, ARCHIVES_TAKE, out totalArchives, customerCompany.CompanyId)); } } if (archivi.Any()) { result.Data = service.GetPreservationVerify(archivi.Select(x => x.IdArchive).ToArray <Guid>(), skip, take, out total, null); } else { result.Data = archivi; } } result.Total = total; } catch (Exception ex) { result.Errors = ex; } return(Json(result, JsonRequestBehavior.AllowGet)); }