public void Session_Title(Context context, string value) { SessionUtilities.Set( context: context, key: "Title", value: value, page: true); }
public void Session_ExportColumns(Context context, string value) { SessionUtilities.Set( context: context, key: "ExportColumns", value: value, page: true); }
public void Session_AddHeader(Context context, string value) { SessionUtilities.Set( context: context, key: "AddHeader", value: value, page: true); }
public void Session_BinarySettings(Context context, string value) { SessionUtilities.Set( context: context, key: "BinarySettings", value: value, page: true); }
public static string Delete(IContext context, SiteSettings ss, long wikiId) { var wikiModel = new WikiModel(context, ss, wikiId); var invalid = WikiValidators.OnDeleting( context: context, ss: ss, wikiModel: wikiModel); switch (invalid) { case Error.Types.None: break; default: return(invalid.MessageJson(context: context)); } var error = wikiModel.Delete(context: context, ss: ss, notice: true); switch (error) { case Error.Types.None: SessionUtilities.Set( context: context, message: Messages.Deleted( context: context, data: wikiModel.Title.Value)); var res = new WikisResponseCollection(wikiModel); res .SetMemory("formChanged", false) .Href(Locations.ItemIndex( context: context, id: Rds.ExecuteScalar_long( context: context, statements: Rds.SelectSites( tableType: Sqls.TableTypes.Deleted, column: Rds.SitesColumn().ParentId(), where : Rds.SitesWhere() .TenantId(context.TenantId) .SiteId(wikiModel.SiteId))))); return(res.ToJson()); default: return(error.MessageJson(context: context)); } }
public static string Create(Context context, SiteSettings ss) { var tenantModel = new TenantModel(context, ss, 0, setByForm: true); var invalid = TenantValidators.OnCreating( context: context, ss: ss, tenantModel: tenantModel); switch (invalid) { case Error.Types.None: break; default: return(invalid.MessageJson(context: context)); } var error = tenantModel.Create(context: context, ss: ss); switch (error) { case Error.Types.None: SessionUtilities.Set( context: context, message: Messages.Created( context: context, data: tenantModel.Title.Value)); return(new ResponseCollection() .Response("id", tenantModel.TenantId.ToString()) .SetMemory("formChanged", false) .Href(Locations.Edit( context: context, controller: context.Controller, id: ss.Columns.Any(o => o.Linking) ? context.Forms.Long("LinkId") : tenantModel.TenantId)) .ToJson()); default: return(error.MessageJson(context: context)); } }
public static string Delete(Context context, SiteSettings ss, int tenantId) { var tenantModel = new TenantModel(context, ss, tenantId); var invalid = TenantValidators.OnDeleting( context: context, ss: ss, tenantModel: tenantModel); switch (invalid) { case Error.Types.None: break; default: return(invalid.MessageJson(context: context)); } var error = tenantModel.Delete(context: context, ss: ss); switch (error) { case Error.Types.None: SessionUtilities.Set( context: context, message: Messages.Deleted( context: context, data: tenantModel.Title.Value)); var res = new TenantsResponseCollection(tenantModel); res .SetMemory("formChanged", false) .Href(Locations.Index( context: context, controller: "Tenants")); return(res.ToJson()); default: return(error.MessageJson(context: context)); } }
public static string RestoreFromHistory( IContext context, SiteSettings ss, long wikiId) { if (!Parameters.History.Restore) { return(Error.Types.InvalidRequest.MessageJson(context: context)); } var wikiModel = new WikiModel(context, ss, wikiId); var invalid = WikiValidators.OnUpdating( context: context, ss: ss, wikiModel: wikiModel); switch (invalid) { case Error.Types.None: break; default: return(invalid.MessageJson(context: context)); } var ver = context.Forms.Data("GridCheckedItems") .Split(',') .Where(o => !o.IsNullOrEmpty()) .ToList(); if (ver.Count() != 1) { return(Error.Types.SelectOne.MessageJson(context: context)); } wikiModel.SetByModel(new WikiModel().Get( context: context, ss: ss, tableType: Sqls.TableTypes.History, where : Rds.WikisWhere() .SiteId(ss.SiteId) .WikiId(wikiId) .Ver(ver.First()))); wikiModel.VerUp = true; var error = wikiModel.Update( context: context, ss: ss, otherInitValue: true); switch (error) { case Error.Types.None: SessionUtilities.Set( context: context, message: Messages.RestoredFromHistory( context: context, data: ver.First().ToString())); return(new ResponseCollection() .SetMemory("formChanged", false) .Href(Locations.ItemEdit( context: context, id: wikiId)) .ToJson()); default: return(error.MessageJson(context: context)); } }