public static ErrorData OnCreating(Context context, ServerScript serverScript) { try { ServerScriptUtilities.Execute( context: context, ss: new SiteSettings { EditorColumnHash = new Dictionary <string, List <string> >(), ColumnHash = new Dictionary <string, Column>() }, itemModel: new BaseItemModel(), view: null, scripts: new ServerScript[] { serverScript }); } catch (Exception ex) { while (ex.InnerException != null) { ex = ex.InnerException; } return(new ErrorData(type: Error.Types.IncorrectServerScript, data: ex.Message)); } return(new ErrorData(type: Error.Types.None)); }
public bool Delete(object id) { if (OnTesting) { return(false); } return(ServerScriptUtilities.Delete( context: Context, id: id.ToLong())); }
public long BulkDelete(object id, string json) { if (OnTesting) { return(0); } return(ServerScriptUtilities.BulkDelete( context: Context, id: id.ToLong(), apiRequestBody: json)); }
public bool Update(object id, object model) { if (OnTesting) { return(false); } return(ServerScriptUtilities.Update( context: Context, id: id.ToLong(), model: model)); }
public long Count(object siteId, string view = null) { var ss = SiteSettingsUtilities.Get( context: Context, siteId: siteId.ToLong()); return(ServerScriptUtilities.Aggregate( context: Context, ss: ss, view: view)); }
public ServerScriptModelApiModel[] Get(object id, string view = null) { if (OnTesting) { return(new ServerScriptModelApiModel[0]); } return(ServerScriptUtilities.Get( context: Context, id: id.ToLong(), view: view, onTesting: OnTesting)); }
private decimal CreateAggregate(object siteId, string columnName, string view, Sqls.Functions function) { var ss = SiteSettingsUtilities.Get( context: Context, siteId: siteId.ToLong()); return(ServerScriptUtilities.Aggregate( context: Context, ss: ss, view: view, columnName: columnName, function: function)); }
public ServerScriptModelApiModel New() { var itemModel = new IssueModel(); var apiContext = ServerScriptUtilities.CreateContext( context: Context, action: "New", id: 0, apiRequestBody: string.Empty); var ss = new SiteSettings( context: apiContext, referenceType: "Issues"); itemModel.SetDefault( context: apiContext, ss: ss); var apiModel = new ServerScriptModelApiModel( context: Context, model: itemModel, onTesting: OnTesting); return(apiModel); }