public JsonResult GetCustomList(string listName) { var client = SvcBldr.AdministrationV2(); var list = client.GetCustomList(listName); return(Result(list.Result, list.Error, JsonRequestBehavior.AllowGet)); }
/// <summary> /// Deletes a record category /// </summary> public JsonResult DeleteRecordCategory(Guid id) { var clientV2 = SvcBldr.AdministrationV2(); var srRecCat = clientV2.DeleteRecordCategory(id); return(Result(null, srRecCat.Error)); }
public JsonResult DeleteBuzzSpaces(Guid Id) { var dc = SvcBldr.AdministrationV2(); BuzzSpace bs = new BuzzSpace { Id = Id }; var ret_status = dc.DeleteBuzzSpace(bs); return(Result(ret_status.Result, ret_status.Error)); }
public JsonResult GetAllData() { var clientV2 = SvcBldr.AdministrationV2(); var freezes = clientV2.GetAllFreezes(); if (freezes != null && freezes.Error != null) { return(Result(null, freezes.Error, JsonRequestBehavior.AllowGet)); } var fList = freezes.Result.ToList(); fList.Insert(0, new Freeze() { Id = Guid.Empty, Name = Constants.i18n("newTitle"), Active = true }); var srRecCats = clientV2.GetAllRecordCategories(); if (srRecCats.Error != null) { return(Result(null, srRecCats.Error, JsonRequestBehavior.AllowGet)); } var rcats = srRecCats.Result.ToList(); rcats.Insert(0, new RecordCategory() { Id = Guid.Empty, Name = Constants.i18n("newTitle") }); var scRC = SvcBldr.SecurityV2().GetSecurityClassSlims(); if (scRC.Error != null) { return(Result(null, scRC.Error, JsonRequestBehavior.AllowGet)); } var customFields = SvcBldr.CustomFieldV2().GetCustomFields(); if (customFields.Error != null) { return(Result(null, customFields.Error, JsonRequestBehavior.AllowGet)); } var dateFields = customFields.Result.Where(c => c.Type == CFTypeCode.DateTime) .Select(f => new SlimEntity(f.Id, f.Name, PermissionType.NotSet)).ToList(); dateFields.Insert(0, new SlimEntity(DateFieldConstants.Created, Constants.i18n("createdOn"), PermissionType.NotSet)); dateFields.Insert(1, new SlimEntity(DateFieldConstants.Modified, Constants.i18n("modifiedOn"), PermissionType.NotSet)); dateFields.Insert(2, new SlimEntity(DateFieldConstants.Accessed, Constants.i18n("accessedOn"), PermissionType.NotSet)); return(Result(new { f = fList.Where(f => f.Active), rcs = rcats, sc = scRC.Result, cf = dateFields }, null, JsonRequestBehavior.AllowGet)); }
public JsonResult GetAllCustomLists() { var client = SvcBldr.AdministrationV2(); var cls = client.GetCustomListsItems(); if (cls.Error != null) { return(Result(null, cls.Error, JsonRequestBehavior.AllowGet)); } cls.Result = cls.Result.Concat(new[] { new CustomListItem { Name = Constants.i18n("newTitle"), Items = new List <string>(), ReadOnly = true } }).ToArray(); return(Result(cls.Result, cls.Error, JsonRequestBehavior.AllowGet)); }
/// <summary> /// Sets (updates/creates) a record category. /// </summary> public JsonResult RecordCategory(RecordCategory recordCategory) { var clientV2 = SvcBldr.AdministrationV2(); var srRecCat = new SR <RecordCategory>(); if (recordCategory.Id == Guid.Empty) { recordCategory.Id = Functions.NewSeq(); srRecCat = clientV2.CreateRecordCategory(recordCategory); } else { srRecCat = clientV2.UpdateRecordCategory(recordCategory); } return(Result(srRecCat.Result, srRecCat.Error)); }
public System.Web.Mvc.ActionResult GetBuzzSpaceEditor(Guid?selectedId, ExceptionsML ex) { var model = new BuzzEditorModel(); try { var dc = SvcBldr.AdministrationV2(); model.Exception = ex; model.BuzzSpaces = new List <BuzzSpace>(); model.BuzzSpaces.Add(new BuzzSpace() { Title = Constants.i18n("newTitle"), Content = "", Id = Guid.Empty }); var b = dc.GetAllBuzzSpace(); if (b.Error != null) { return(Result(null, b.Error, JsonRequestBehavior.AllowGet)); } model.BuzzSpaces.AddRange(b.Result); if (selectedId.HasValue) { var selected = model.BuzzSpaces.FirstOrDefault(r => r.Id == selectedId.Value); if (selected != null) { model.SelectedBuzz = selected; } } else { var userBS = dc.GetCurrentBuzzSpace(false); if (userBS != null && userBS.Result != null) { model.SelectedBuzz = model.BuzzSpaces.FirstOrDefault(r => r.Id == userBS.Result.Id); } if (model.SelectedBuzz == null) { model.SelectedBuzz = model.BuzzSpaces.First(); } } } catch (Exception err) { model.Exception = ExceptionsML.GetExceptionML(err); } return(View(model)); }
/// <summary> /// Sets (updates/creates) a freeze. /// </summary> public JsonResult Freeze(Freeze freeze) { var clientV2 = SvcBldr.AdministrationV2(); freeze.EffectiveDate = DateTime.Now; var updatedFreeze = new SR <Freeze>(); if (freeze.Id == Guid.Empty) { freeze.Id = Functions.NewSeq(); updatedFreeze = clientV2.CreateFreeze(freeze); } else { updatedFreeze = clientV2.UpdateFreeze(freeze); } return(Result(updatedFreeze.Result, updatedFreeze.Error)); }
public JsonResult GetAllData() { var cfClient = SvcBldr.CustomFieldV2(); var adClient = SvcBldr.AdministrationV2(); var client = SvcBldr.SearchV2(); var result = cfClient.GetCustomFields(); if (result.Error != null) { return(Result(null, result.Error, JsonRequestBehavior.AllowGet)); } var lists = adClient.GetCustomListsSlim(); if (lists.Error != null) { return(Result(null, lists.Error, JsonRequestBehavior.AllowGet)); } var sr = client.GetFieldNames(); if (sr.Error != null) { return(Result(null, sr.Error, JsonRequestBehavior.AllowGet)); } var srGroups = cfClient.GetGroups(); if (srGroups.Error != null) { return(Result(null, srGroups.Error, JsonRequestBehavior.AllowGet)); } var fieldsnames = sr.Result.Where(r => result.Result == null || result.Result.ToList().All(l => l.Name != r)).ToList(); fieldsnames.AddRange(new List <string> { "id", Constants.CN_ENTITY_ID, Constants.DOCTYPE, Constants.DOCID, Constants.WFDOCID, Constants.APPID, Constants.SF_TYPE }); return(Result(new { cfs = result.Result, cls = lists.Result, cfg = srGroups.Result, spnms = fieldsnames }, null, JsonRequestBehavior.AllowGet)); }
public System.Web.Mvc.ActionResult GetBuzzSpaceEditor(BuzzSpace buzz) { var client = SvcBldr.AdministrationV2(); var model = new BuzzEditorModel(); buzz.DefaultAd = Context.Request.Form["DefaultAd"] != null; if (buzz.Title == null) { return(GetBuzzSpaceEditor(Guid.Empty, new ExceptionsML { Message = Constants.i18n("titleEmptyWarning") })); } else { buzz.Title.Trim(); } if (Context.Request.Form["MonthsOfYear"] != null) { buzz.MonthsOfYear = (MonthsOfYear)Enum.Parse(typeof(MonthsOfYear), Context.Request.Form["MonthsOfYear"]); } if (Context.Request.Form["DaysOfWeek"] != null) { buzz.DaysOfWeek = (DaysOfWeek)Enum.Parse(typeof(DaysOfWeek), Context.Request.Form["DaysOfWeek"]); } if (buzz.Id == Guid.Empty) { buzz.Id = Guid.NewGuid(); } if (buzz.DaysOfMonth != null && buzz.DaysOfMonth.Count > 1) { if (buzz.DaysOfMonth.Any(r => r == 0)) { buzz.DaysOfMonth.Remove(0); } } var t = client.SetBuzzSpace(buzz); return(GetBuzzSpaceEditor(buzz.Id, t.Error)); }
public System.Web.Mvc.ActionResult SendIdeaMessage(string message, string url) { try { var adminClient = SvcBldr.AdministrationV2(); StringBuilder bodyBuilder = new StringBuilder(); bodyBuilder.AppendLine("<html>"); bodyBuilder.Append(System.IO.File.ReadAllText(Server.MapPath(Url.Content("~/Content/templates/IdeaEmailTemplate.htm")))); bodyBuilder.AppendLine("</html>"); var sr = adminClient.IdeaMessage(new IdeaMessagePackage { BodyTemplate = bodyBuilder.ToString(), ContextURI = url, Message = message }); return(Result(sr.Result, sr.Error)); } catch (Exception ex) { return(View("../Home/Oops", ExceptionsML.GetExceptionML(ex))); } }
public JsonResult GetFreezes(bool includeNew = true) { var clientV2 = SvcBldr.AdministrationV2(); ExceptionsML bizEx = null; var freezes = clientV2.GetAllFreezes(); if (freezes != null && freezes.Error != null) { return(Result(null, bizEx, JsonRequestBehavior.AllowGet)); } var fList = freezes.Result.ToList(); if (includeNew) { fList.Insert(0, new Freeze() { Id = Guid.Empty, Name = Constants.i18n("newTitle"), Active = true }); } return(Result(fList.Where(f => f.Active).OrderBy(f => f.Name), freezes.Error, JsonRequestBehavior.AllowGet)); }
public JsonResult Search(string userName, string title, string description, DateTime?startDate, DateTime?endDate, ActionType actionType = ActionType.Modified, EntityType entityType = EntityType.All, int page = 1, int maxRows = 100, string sidx = "CreatedOn", string sord = "asc") { var client = SvcBldr.AdministrationV2(); var r = client.SearchAudit(new AuditSearchCriteria() { User = userName, Title = title, Description = description, Type = actionType, EntityType = entityType, StartDate = startDate, EndDate = endDate, Start = (page - 1) * maxRows, MaxRows = maxRows, SortBy = sidx, SortOrder = sord }); return(Result(r.Result, r.Error, JsonRequestBehavior.AllowGet)); }
public System.Web.Mvc.ActionResult GetCurrentBuzzSpaces() { var client = SvcBldr.AdministrationV2(); List <BuzzSpace> buzzes = new List <BuzzSpace>(); var userBS = client.GetCurrentBuzzSpace(false); if (userBS.Error != null) { return(Result(null, userBS.Error, JsonRequestBehavior.AllowGet)); } var sysBS = client.GetCurrentBuzzSpace(true); if (sysBS.Error != null) { return(Result(null, sysBS.Error, JsonRequestBehavior.AllowGet)); } buzzes.Add(userBS.Result); buzzes.Add(sysBS.Result); return(View(buzzes)); }
public System.Web.Mvc.ActionResult SendHelpMessage(string message, string clientData, string contextURI) { try { var adminClient = SvcBldr.AdministrationV2(); if (!String.IsNullOrEmpty(clientData)) { var cd = JsonConvert.DeserializeObject(clientData); clientData = JsonConvert.SerializeObject(cd, Formatting.Indented); } var requestData = new { Request.AcceptTypes, Request.ApplicationPath, Browser = new { Request.Browser.Capabilities, Request.Browser.Cookies, Request.Browser.Crawler, Request.Browser.Id, Request.Browser.IsColor, Request.Browser.IsMobileDevice, Request.Browser.JavaApplets, Request.Browser.JScriptVersion, Request.Browser.MaximumHrefLength, Request.Browser.MaximumRenderedPageSize, Request.Browser.MaximumSoftkeyLabelLength, Request.Browser.MobileDeviceManufacturer, Request.Browser.MobileDeviceModel, Request.Browser.Platform, Request.Browser.SupportsXmlHttp, Request.Browser.Version, Request.Browser.W3CDomVersion, Request.Browser.Win32 }, Request.ContentEncoding, Request.Cookies, Request.HttpMethod, Request.IsAuthenticated, Request.IsLocal, Request.IsSecureConnection, Request.Path, Request.PathInfo, Request.RawUrl, Request.UrlReferrer, Request.UserAgent, Request.UserHostAddress, Request.UserHostName, Request.UserLanguages }; var requestStr = JsonConvert.SerializeObject(requestData, Formatting.Indented); var bodyBuilder = new StringBuilder(); bodyBuilder.AppendLine("<html>"); bodyBuilder.Append(System.IO.File.ReadAllText(Server.MapPath(Url.Content("~/Content/templates/HelpEmailTemplate.htm")))); bodyBuilder.AppendLine("</html>"); var sr = adminClient.HelpMessage(new HelpMessagePackage { BodyTemplate = bodyBuilder.ToString(), ClientData = clientData, ContextURI = contextURI, Message = message, RequestData = requestStr, WebResourceInfo = GetWebResources() }); return(Result(sr.Result, sr.Error)); } catch (Exception ex) { return(View("../Home/Oops", ExceptionsML.GetExceptionML(ex))); } }
/// <summary> /// Retrieves all data required by the designer /// </summary> public JsonResult GetData() { var wfSvc = SvcBldr.WorkflowV2(); var secSvc = SvcBldr.SecurityV2(); var ibxSvc = SvcBldr.InboxV2(); var companySvc = SvcBldr.Company(); var adminSvc = SvcBldr.AdministrationV2(); var userSvc = SvcBldr.UserV2(); var dlSvc = SvcBldr.DataLinkV2(); var ctSvc = SvcBldr.ContentTypeV2(); var cfSvc = SvcBldr.CustomFieldV2(); var licSvc = SvcBldr.LicenseV2(); var docSVC = SvcBldr.DocumentV2(); var searchSvc = SvcBldr.SearchV2(); var tokens = licSvc.GetLicenseTokens(); if (tokens.Error != null) { return(Result(null, tokens.Error)); } var dbFieldsSR = searchSvc.GetFields(); if (dbFieldsSR.Error != null) { return(Result(null, dbFieldsSR.Error)); } var dbFields = dbFieldsSR.Result; var advancedWF = false; if (tokens.Result != null) { advancedWF = tokens.Result.HasTokenKey(TokenKey.AdvancedWorkflow); } var customLists = adminSvc.GetCustomListsSlim(); if (customLists.Error != null) { return(Result(null, customLists.Error)); } var userPrefsSR = userSvc.GetPreferences(); if (userPrefsSR.Error != null) { return(Result(null, userPrefsSR.Error)); } var userPrefsKVP = new Dictionary <String, String>(); var upLen = userPrefsSR.Result.Length; for (int i = 0; i < upLen; i++) { if (userPrefsKVP.ContainsKey(userPrefsSR.Result[i].Key)) { continue; } userPrefsKVP.Add(userPrefsSR.Result[i].Key, userPrefsSR.Result[i].Value); } var allTasks = TaskDesignProperties.GetAll(); var uiTasks = allTasks.Where(r => r.NeedsUserInput); var clientTasks = allTasks.Where(r => r.NeedsClientService); var autoTasks = allTasks.Where(r => !r.NeedsClientService && !r.NeedsUserInput).ToList(); var actionLibrary = wfSvc.GetActionLibrarySlim(); if (actionLibrary.Error != null) { return(Result(null, actionLibrary.Error)); } actionLibrary.Result.Append(new SlimActionLibraryItem() { Id = Guid.Empty, EffectivePermissions = (int)PermissionType.Full, Name = Constants.i18n("newTitle"), Type = (int)WFActionType.LibraryItem }); var wfNames = wfSvc.GetSlim(); if (wfNames.Error != null) { return(Result(null, wfNames.Error)); } var wfNamesWithNew = wfNames.Result.Prepend(new SlimEntity(Guid.Empty, Constants.i18n("newTitle"), PermissionType.Full)); var inboxes = ibxSvc.GetSlim(); if (inboxes.Error != null) { return(Result(null, inboxes.Error)); } var inboxNVP = inboxes.Result.ToDictionary(k => k.Id.ToString(), v => v.Name); var contentTypes = ctSvc.GetContentTypesSlim(); if (contentTypes.Error != null) { return(Result(null, contentTypes.Error)); } var ctNVP = contentTypes.Result.ToDictionary(k => k.Id.ToString(), v => v.Name); var securityClasses = secSvc.GetAllSecurityClassesSlim(); if (securityClasses.Error != null) { return(Result(null, securityClasses.Error)); } var scNVP = securityClasses.Result.ToDictionary(k => k.Id.ToString(), v => v.Name); var users = userSvc.GetAll(); if (users.Error != null) { return(Result(null, users.Error)); } var slimUsers = users.Result.Select(r => new { Id = r.Id, Username = r.Username, Flags = r.Flags, SiteUser = r.SiteUser }).ToList(); var roles = secSvc.GetAllRolesSlim(); if (roles.Error != null) { return(Result(null, roles.Error)); } var rolesNVP = roles.Result.ToDictionary(k => k.Id.ToString(), v => v.Name); var customFields = cfSvc.GetCustomFields(); if (customFields.Error != null) { return(Result(null, customFields.Error)); } var customFieldsNVP = customFields.Result.ToDictionary(k => k.Id.ToString(), v => v.Name); var cfGroupsSR = cfSvc.GetGroups(); if (cfGroupsSR.Error != null) { return(Result(null, cfGroupsSR.Error)); } var docProps = WFDocMeta.GetProperties(); var args = new Dictionary <string, WFMetaPropertyInfo> { { Constants.i18n("argSysCurrUser"), new WFMetaPropertyInfo() { Name = Argument.SystemProperty(SystemArguments.CurrentUser), ReadOnly = true, PropertyType = CFTypeCode.Object, SupportedActionType = WFActionType.SyncVerifyAction | WFActionType.AutoRun } }, { Constants.i18n("argSysNow"), new WFMetaPropertyInfo() { Name = Argument.SystemProperty(SystemArguments.Now), ReadOnly = true, PropertyType = CFTypeCode.DateTime, SupportedActionType = WFActionType.SyncVerifyAction | WFActionType.AutoRun } }, { Constants.i18n("argSysToday"), new WFMetaPropertyInfo() { Name = Argument.SystemProperty(SystemArguments.Today), ReadOnly = true, PropertyType = CFTypeCode.DateTime, SupportedActionType = WFActionType.SyncVerifyAction | WFActionType.AutoRun } }, { Constants.i18n("argSysTomorrow"), new WFMetaPropertyInfo() { Name = Argument.SystemProperty(SystemArguments.Tomorrow), ReadOnly = true, PropertyType = CFTypeCode.DateTime, SupportedActionType = WFActionType.SyncVerifyAction | WFActionType.AutoRun } }, { Constants.i18n("argDocFolder"), new WFMetaPropertyInfo() { Name = Argument.DocProperty(Argument.FOLDERS), ReadOnly = true, PropertyType = CFTypeCode.Object, SupportedActionType = WFActionType.SyncAutoRunAction } }, { Constants.i18n("argDocText"), new WFMetaPropertyInfo() { Name = Argument.DocProperty(Argument.TEXT), ReadOnly = false, PropertyType = CFTypeCode.String, Indexable = true, SupportedActionType = WFActionType.SyncVerifyAction | WFActionType.AutoRun } } }; foreach (var docProp in docProps) { args.Add(Constants.i18n("argDoc" + docProp.Name), new WFMetaPropertyInfo() { Name = Argument.DocProperty(docProp.Name), ReadOnly = docProp.ReadOnly, PropertyType = docProp.PropertyType, SupportedActionType = docProp.SupportedActionType }); } foreach (var cf in customFields.Result) { args.Add(String.Format(Constants.i18n("argDocCustomField"), cf.Name), new WFMetaPropertyInfo() { Name = Argument.DocCustomField(cf.Name), ReadOnly = false, PropertyType = cf.Type, SupportedActionType = WFActionType.SyncVerifyAction | WFActionType.AutoRun }); } var orderedArgs = args.OrderBy(r => r.Key).ToDictionary(k => k.Key, v => v.Value); var datalinks = new SR <DataLinkQueryPackage[]>(); if (!(tokens.Result != null && tokens.Result.HasTokenKey(TokenKey.DataLink))) { autoTasks.Remove(autoTasks.First(r => r.TaskClassName == "DatalinkTask")); } else { datalinks = dlSvc.GetDataLinkQueries(); if (datalinks.Error != null) { return(Result(null, datalinks.Error)); } } var recognitionOptions = docSVC.GetRecognitionOptions(); if (recognitionOptions.Error != null) { return(Result(null, recognitionOptions.Error)); } var xml = this.GetHelpXML("en"); // TRANSLATE THIS FRIGGIN KEY ;) var retObj = new { HelpXMLString = xml, BuiltInArgs = orderedArgs, ActionLibrary = actionLibrary.Result, UITasks = uiTasks, ClientTasks = clientTasks, AutoTasks = autoTasks, Workflows = wfNamesWithNew, Inboxes = inboxNVP, ContentTypes = ctNVP, CustomFields = customFieldsNVP, SecurityClasses = scNVP, Users = slimUsers, Roles = rolesNVP, AdvancedWF = advancedWF, CustomLists = customLists.Result, Datalinks = datalinks.Result, UserPreferences = userPrefsKVP, CustomFieldGroups = cfGroupsSR.Result, RecognitionOptions = recognitionOptions.Result, DatabaseFields = dbFields }; return(Result(retObj, null)); }