public ActionResult Bulk(string metaViewName) { var dataSource = new DynamicEntityJSONDataSource(); var isNew = Request.HttpMethod.Equals("POST", StringComparison.InvariantCultureIgnoreCase); SecurityPermissionBaseTypeEnum type = isNew ? SecurityPermissionBaseTypeEnum.Add : SecurityPermissionBaseTypeEnum.Edit; if (!SecurityCache.ViewCan(metaViewName, type)) { return(new ContentResult { ContentType = "text/html", Content = DynamicEntityJSONDataSource.GetNotSuccess(WsFactory.GetАccessDeniedPage()) }); } var entityOperationType = DynamicEntityJSONDataSource.GetEntityOperationType(Request.QueryString); return(new ContentResult { ContentType = "text/html", Content = dataSource.BulkApply(metaViewName, Request.Body(), isNew, entityOperationType) }); }
public ActionResult GetSettings() { var menuList = WsFactory.GetMenu((byte)0); var objectList = MetaViewHelper.GetAll(); dynamic data = new { general = new { id = SecurityCache.CurrentUser.Id, name = SecurityCache.CurrentUser.Name, email = SecurityCache.CurrentUser.Email }, menu = menuList, objects = objectList.Select(c => new { c.Id, c.Name, c.Caption }), security = new { }, subscribe = new { } }; return(new ContentResult { ContentType = "text/html", Content = JsonSerializer.SerializeToString(data) }); }
public ActionResult GetDocumentIds(Guid docTypeId, long startIndex = 0, long count = 0) { if (!CheckCurrentPermission()) { return(Content(WsFactory.GetАccessDeniedHtmlFrom())); } string metaViewName = WsFactory.GetMetaViewByDocTypeForSearch(docTypeId); ArrayList ids = new ArrayList(); if (!string.IsNullOrWhiteSpace(metaViewName)) { var dataSource = new DynamicEntityJSONDataSource(); var data = dataSource.GetDataKey(metaViewName, null, startIndex, count); data.ToDataTable(); var att = data.Metadata.Attributes.FirstOrDefault(); foreach (DynamicEntity item in data.Entities) { ids.Add(item.GetProperty(att.PropertyName)); } } return(new ContentResult { ContentType = "text/html", Content = JsonSerializer.SerializeToString(ids) }); }
public ActionResult GetContent(string form, string id) { var dictionary = Request.QueryString.AllKeys.ToDictionary(key => key, key => Request.QueryString[key]); var query = (dictionary.Count > 0 ? "?" + Request.QueryString : ""); if (id != null) { if (!dictionary.Keys.Any(k => k.Equals("id", StringComparison.InvariantCultureIgnoreCase))) { dictionary.Add("id", id); } } if (CommonSettings.CurrentEmployee == null) { form = "AccessDenied"; } var wsForm = WsFactory.CreateModel(form, dictionary, query, Request.Url.PathAndQuery); EventsLogHelper.WorkspaceEvent(wsForm.Name, wsForm.Caption, Request); return(Content(wsForm.Body)); }
public ActionResult GetDocumentTypes() { if (!CheckCurrentPermission()) { return(Content(WsFactory.GetАccessDeniedHtmlFrom())); } var forms = MetaFormHelper.GetAvailableForSearch(); return(new ContentResult { ContentType = "text/html", Content = JsonSerializer.SerializeToString(forms.OrderBy(c => c.SearchWeight).OrderBy(c => c.Caption).Select(c => new { c.Id, Name = c.Caption, Weight = c.SearchWeight }).ToArray()) }); }
public ActionResult CheckPermission(Guid docTypeId, object id, string userId, string userLogin) { if (!CheckCurrentPermission()) { return(null); } string metaViewName = WsFactory.GetMetaViewByDocTypeForSearch(docTypeId); if (string.IsNullOrWhiteSpace(metaViewName)) { return(Content("Представление для типа не найдено!")); } return(null); }
public ActionResult GetDocument(Guid docTypeId, Guid id) { if (!CheckCurrentPermission()) { return(Content(WsFactory.GetАccessDeniedHtmlFrom())); } WsDocumentInfo di = WsFactory.GetWsDocumentInfo(docTypeId, id); di.Url = string.Format("#WS/{0}/GetWindowContent/{1}", di.FormName, di.Id); return(new ContentResult { ContentType = "text/html", Content = JsonSerializer.SerializeToString(di) }); }
public ActionResult GetDocumentPrintForm(Guid docTypeId, Guid id) { if (!CheckCurrentPermission()) { return(Content(WsFactory.GetАccessDeniedHtmlFrom())); } WsDocumentInfo di = WsFactory.GetWsDocumentInfo(docTypeId, id); di.Url = string.Format("/WS/{0}/{1}", di.DocTypeName, di.Id); return(new ContentResult { ContentType = "text/html", Content = di.HTMLContent }); }
public ActionResult GetHistory(string metaViewName, Guid id) { if (!SecurityCache.ViewCan(metaViewName, SecurityPermissionBaseTypeEnum.View)) { return(new ContentResult { ContentType = "text/html", Content = DynamicEntityJSONDataSource.GetNotSuccess(WsFactory.GetАccessDeniedPage()) }); } return(new ContentResult { ContentType = "text/html", Content = VersionFormatter.GetObjectHistoryInHtml(id) }); }
public ActionResult GetDocumentCount(Guid docTypeId) { if (!CheckCurrentPermission()) { return(Content(WsFactory.GetАccessDeniedHtmlFrom())); } string metaViewName = WsFactory.GetMetaViewByDocTypeForSearch(docTypeId); long count = 0; if (!string.IsNullOrWhiteSpace(metaViewName)) { var dataSource = new DynamicEntityJSONDataSource(); count = dataSource.GetDataCount(metaViewName, null); } return(Content(JsonSerializer.SerializeToString(count))); }
public ActionResult ExportCSV(string metaViewName, string entityIds) { if (!SecurityCache.ViewCan(metaViewName, SecurityPermissionBaseTypeEnum.View)) { return(Content(WsFactory.GetАccessDeniedHtmlFrom())); } EventsLogHelper.ExportData("CSV", metaViewName, Request); EntityContainer data; if (string.IsNullOrEmpty(entityIds)) { data = GetDataFromRequest(metaViewName); } else { data = GetDataFromRequest(metaViewName, entityIds); } return(File(data.ToCsv(DynamicEntityJSONDataSource.GetFieldColumns(Request.QueryString)), "application/CSV", string.Format("{0}.csv", metaViewName))); }
public ActionResult ExportXls(string metaViewName, string entityIds) { if (!SecurityCache.ViewCan(metaViewName, SecurityPermissionBaseTypeEnum.View)) { return(Content(WsFactory.GetАccessDeniedHtmlFrom())); } EventsLogHelper.ExportData("Xls", metaViewName, Request); EntityContainer data; if (string.IsNullOrEmpty(entityIds)) { data = GetDataFromRequest(metaViewName); } else { data = GetDataFromRequest(metaViewName, entityIds); } var dt = data.ToDataTable(DynamicEntityJSONDataSource.GetFieldColumns(Request.QueryString)); return(GridExportHelper.ExportToXls(metaViewName, dt)); }
public ActionResult Get(string metaViewName) { ActionResult res = new EmptyResult(); var dataSource = new DynamicEntityJSONDataSource(); if (Request.HttpMethod.Equals("GET", StringComparison.InvariantCultureIgnoreCase)) { if (!SecurityCache.ViewCan(metaViewName, SecurityPermissionBaseTypeEnum.View)) { return(new ContentResult { ContentType = "text/html", Content = DynamicEntityJSONDataSource.GetNotSuccess(WsFactory.GetАccessDeniedPage()) }); } var extra = DynamicEntityJSONDataSource.GetExtra(Request.QueryString).ToLower(); res = Get(metaViewName, dataSource, extra); } else if (Request.HttpMethod.Equals("POST", StringComparison.InvariantCultureIgnoreCase)) { if (!SecurityCache.ViewCan(metaViewName, SecurityPermissionBaseTypeEnum.Add)) { return(new ContentResult { ContentType = "text/html", Content = DynamicEntityJSONDataSource.GetNotSuccess(WsFactory.GetАccessDeniedPage()) }); } var updatedJson = Request.Body(); res = new ContentResult { ContentType = "text/html", Content = dataSource.Insert(metaViewName, DynamicEntityJSONDataSource.GetEntityOperationType(Request.QueryString), updatedJson, DynamicEntityJSONDataSource.GetExtra(Request.Params), DynamicEntityJSONDataSource.GetVisibility(Request.QueryString), DynamicEntityJSONDataSource.GetBaseEntityIdName(Request.Params), DynamicEntityJSONDataSource.GetBaseEntityIdValue(Request.Params)) }; } else if (Request.HttpMethod.Equals("PUT", StringComparison.InvariantCultureIgnoreCase)) { if (!SecurityCache.ViewCan(metaViewName, SecurityPermissionBaseTypeEnum.Edit)) { return(new ContentResult { ContentType = "text/html", Content = DynamicEntityJSONDataSource.GetNotSuccess(WsFactory.GetАccessDeniedPage()) }); } var updatedJson = Request.Body(); res = new ContentResult { ContentType = "text/html", Content = dataSource.Update(metaViewName, updatedJson, DynamicEntityJSONDataSource.GetExtra(Request.Params), DynamicEntityJSONDataSource.GetVisibility(Request.QueryString), DynamicEntityJSONDataSource.GetBaseEntityIdName(Request.QueryString), DynamicEntityJSONDataSource.GetBaseEntityIdValue(Request.QueryString)) }; } else if (Request.HttpMethod.Equals("DELETE", StringComparison.InvariantCultureIgnoreCase)) { if (!SecurityCache.ViewCan(metaViewName, SecurityPermissionBaseTypeEnum.Delete)) { return(new ContentResult { ContentType = "text/html", Content = DynamicEntityJSONDataSource.GetNotSuccess(WsFactory.GetАccessDeniedPage()) }); } var updatedJson = Request.Body(); string validateRes = string.Empty; if (metaViewName != "Budget") { if (!MetadataRepositoty.ValidadateDelete(metaViewName, updatedJson, out validateRes)) { return(new ContentResult { ContentType = "text/html", Content = DynamicEntityJSONDataSource.GetNotSuccess(validateRes) }); } } res = new ContentResult { ContentType = "text/html", Content = dataSource.Delete(metaViewName, updatedJson, DynamicEntityJSONDataSource.GetExtra(Request.Params), DynamicEntityJSONDataSource.GetBaseEntityIdName(Request.QueryString), DynamicEntityJSONDataSource.GetBaseEntityIdValue(Request.QueryString)) }; } return(res); }
public ActionResult GetAJAXTree(string metaViewName) { ActionResult res = new EmptyResult(); var dataSource = new DynamicEntityJSONDataSource(); if (Request.HttpMethod.Equals("GET", StringComparison.InvariantCultureIgnoreCase)) { if (!SecurityCache.ViewCan(metaViewName, SecurityPermissionBaseTypeEnum.View)) { return(new ContentResult { ContentType = "text/html", Content = DynamicEntityJSONDataSource.GetNotSuccess(WsFactory.GetАccessDeniedPage()) }); } res = new ContentResult { ContentType = "text/html", Content = dataSource.GetJSONAJAXTreeData(metaViewName, DynamicEntityJSONDataSource.GetSort(Request.QueryString), DynamicEntityJSONDataSource.GetSearch(Request.QueryString), DynamicEntityJSONDataSource.GetExtra(Request.Params), DynamicEntityJSONDataSource.GetBaseEntityIdName(Request.QueryString), DynamicEntityJSONDataSource.GetBaseEntityIdValue(Request.QueryString), DynamicEntityJSONDataSource.GetCallback(Request.QueryString), DynamicEntityJSONDataSource.GetNodeValue(Request.QueryString), DynamicEntityJSONDataSource.GetVisibility(Request.QueryString), GetShowDeleted(metaViewName) ) }; } else if (Request.HttpMethod.Equals("DELETE", StringComparison.InvariantCultureIgnoreCase)) { if (!SecurityCache.ViewCan(metaViewName, SecurityPermissionBaseTypeEnum.Delete)) { return(new ContentResult { ContentType = "text/html", Content = DynamicEntityJSONDataSource.GetNotSuccess(WsFactory.GetАccessDeniedPage()) }); } var updatedJson = Request.Body(); string validateRes = string.Empty; if (!MetadataRepositoty.ValidadateDelete(metaViewName, updatedJson, out validateRes)) { return(new ContentResult { ContentType = "text/html", Content = DynamicEntityJSONDataSource.GetNotSuccess(validateRes) }); } return(new ContentResult { ContentType = "text/html", Content = dataSource.Delete(metaViewName, updatedJson, DynamicEntityJSONDataSource.GetExtra(Request.Params), DynamicEntityJSONDataSource.GetBaseEntityIdName(Request.QueryString), DynamicEntityJSONDataSource.GetBaseEntityIdValue(Request.QueryString)) }); } return(res); }
public ActionResult GenerateStoreForLeftMenu(string name) { string res = ExtJSGenerator.GenerateStoreForLeftMenu(name, WsFactory.GetLeftMenu()); return(Content(res, "text/javascript")); }