public static System.Data.IDataReader PageDataLoadSpacesSupportBySupport(CodeFluent.Runtime.PageOptions pageOptions, SoftFluent.Json.NET.Support support) { if ((support == null)) { return(null); } if ((support.Id == -1)) { CodeFluent.Runtime.CodeFluentRuntimeException.Throw("invalidEntityKey", "Id", "support", "SoftFluent.Json.NET.Support"); } CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Json.NET.Constants.SoftFluent_Json_NETStoreName).Persistence; persistence.CreateStoredProcedureCommand(null, "Space", "LoadSpacesSupportBySupport"); persistence.AddParameter("@SupportId", support.Id, ((int)(-1))); if ((pageOptions != null)) { System.Collections.IEnumerator enumerator = pageOptions.OrderByArguments.GetEnumerator(); bool b; int index = 0; for (b = enumerator.MoveNext(); b; b = enumerator.MoveNext()) { CodeFluent.Runtime.OrderByArgument argument = ((CodeFluent.Runtime.OrderByArgument)(enumerator.Current)); persistence.AddParameter(string.Format("@_orderBy{0}", index), argument.Name); persistence.AddParameter(string.Format("@_orderByDirection{0}", index), ((int)(argument.Direction))); index = (index + 1); } } System.Data.IDataReader reader = CodeFluentContext.Get(SoftFluent.Json.NET.Constants.SoftFluent_Json_NETStoreName).Persistence.ExecuteReader(); return(reader); }
public static int DeleteByTypeAndValue(SoftFluent.Samples.AspNetIdentity1.User user, string type, string value) { if ((user == null)) { throw new System.ArgumentNullException("user"); } if ((user.Id == default(string))) { CodeFluent.Runtime.CodeFluentRuntimeException.Throw("invalidEntityKey", "Id", "user", "SoftFluent.Samples.AspNetIdentity1.User"); } if ((type == default(string))) { throw new System.ArgumentNullException("type"); } if ((value == default(string))) { throw new System.ArgumentNullException("value"); } CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Samples.AspNetIdentity1.Constants.SoftFluent_Samples_AspNetIdentity1StoreName).Persistence; persistence.CreateStoredProcedureCommand(null, "UserClaim", "DeleteByTypeAndValue"); persistence.AddParameter("@UserId", user.Id, default(string)); persistence.AddParameter("@Type", type, default(string)); persistence.AddParameter("@Value", value, default(string)); int count; count = persistence.ExecuteScalar(-1); return(count); }
public static SoftFluent.Samples.GED.Page LoadOneToProcess() { SoftFluent.Samples.GED.Page page = new SoftFluent.Samples.GED.Page(); CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Samples.GED.Constants.SoftFluent_Samples_GEDStoreName).Persistence; persistence.CreateStoredProcedureCommand(null, "Page", "LoadOneToProcess"); System.Data.IDataReader reader = null; try { reader = persistence.ExecuteReader(); if ((reader.Read() == true)) { page.ReadRecord(reader, CodeFluent.Runtime.CodeFluentReloadOptions.Default); page.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged; return(page); } } finally { if ((reader != null)) { reader.Dispose(); } persistence.CompleteCommand(); } return(null); }
public static ModelCodeFluent.Vehicle LoadByVehicleId(System.Guid vehicleId) { if ((vehicleId.Equals(CodeFluentPersistence.DefaultGuidValue) == true)) { return(null); } ModelCodeFluent.Vehicle vehicle = new ModelCodeFluent.Vehicle(); CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(ModelCodeFluent.Constants.ModelCodeFluentStoreName).Persistence; persistence.CreateStoredProcedureCommand(null, "Vehicle", "LoadByVehicleId"); persistence.AddParameter("@VehicleId", vehicleId, CodeFluentPersistence.DefaultGuidValue); System.Data.IDataReader reader = null; try { reader = persistence.ExecuteReader(); if ((reader.Read() == true)) { vehicle.ReadRecord(reader, CodeFluent.Runtime.CodeFluentReloadOptions.Default); vehicle.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged; return(vehicle); } } finally { if ((reader != null)) { reader.Dispose(); } persistence.CompleteCommand(); } return(null); }
public static SoftFluent.Json.NET.Space LoadByName(string name) { if ((name == default(string))) { return(null); } SoftFluent.Json.NET.Space space = new SoftFluent.Json.NET.Space(); CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Json.NET.Constants.SoftFluent_Json_NETStoreName).Persistence; persistence.CreateStoredProcedureCommand(null, "Space", "LoadByName"); persistence.AddParameter("@Name", name, default(string)); System.Data.IDataReader reader = null; try { reader = persistence.ExecuteReader(); if ((reader.Read() == true)) { space.ReadRecord(reader, CodeFluent.Runtime.CodeFluentReloadOptions.Default); space.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged; return(space); } } finally { if ((reader != null)) { reader.Dispose(); } persistence.CompleteCommand(); } return(null); }
public static void SaveLocalizedValues(SoftFluent.Samples.RedisCache.Category entity, int lcid, bool isDefault, string name) { if ((entity == null)) { throw new System.ArgumentNullException("entity"); } if ((entity.Id.Equals(CodeFluentPersistence.DefaultGuidValue) == true)) { CodeFluent.Runtime.CodeFluentRuntimeException.Throw("invalidEntityKey", "Id", "entity", "SoftFluent.Samples.RedisCache.Category"); } CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Samples.RedisCache.Constants.SoftFluent_Samples_RedisCacheStoreName).Persistence; persistence.CreateStoredProcedureCommand(null, "Category", "SaveLocalizedValues"); persistence.AddParameter("@entityId", entity.Id, CodeFluentPersistence.DefaultGuidValue); persistence.AddParameter("@Lcid", lcid); persistence.AddRawParameter("@IsDefault", isDefault); persistence.AddParameter("@Name", name, default(string)); System.Data.IDataReader reader = null; try { reader = persistence.ExecuteReader(); SoftFluent.Samples.RedisCache.Category.SaveLocalizedValuesUpdateRowVersion(reader, entity, lcid, isDefault, name); } finally { if ((reader != null)) { reader.Dispose(); } persistence.CompleteCommand(); } }
public static DigitalPicnik.Item LoadById(System.Guid id) { if ((id.Equals(CodeFluentPersistence.DefaultGuidValue) == true)) { return(null); } DigitalPicnik.Item item = new DigitalPicnik.Item(); CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(DigitalPicnik.Constants.DigitalPicnikStoreName).Persistence; persistence.CreateStoredProcedureCommand(null, "Item", "LoadById"); persistence.AddParameter("@Id", id, CodeFluentPersistence.DefaultGuidValue); System.Data.IDataReader reader = null; try { reader = persistence.ExecuteReader(); if ((reader.Read() == true)) { item.ReadRecord(reader, CodeFluent.Runtime.CodeFluentReloadOptions.Default); item.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged; return(item); } } finally { if ((reader != null)) { reader.Dispose(); } persistence.CompleteCommand(); } return(null); }
public static ModelCodeFluent.Identity.UserClaim LoadById(System.Guid id) { if ((id.Equals(CodeFluentPersistence.DefaultGuidValue) == true)) { return(null); } ModelCodeFluent.Identity.UserClaim userClaim = new ModelCodeFluent.Identity.UserClaim(); CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(ModelCodeFluent.Constants.ModelCodeFluentStoreName).Persistence; persistence.CreateStoredProcedureCommand(null, "UserClaim", "LoadById"); persistence.AddParameter("@Id", id, CodeFluentPersistence.DefaultGuidValue); System.Data.IDataReader reader = null; try { reader = persistence.ExecuteReader(); if ((reader.Read() == true)) { userClaim.ReadRecord(reader, CodeFluent.Runtime.CodeFluentReloadOptions.Default); userClaim.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged; return(userClaim); } } finally { if ((reader != null)) { reader.Dispose(); } persistence.CompleteCommand(); } return(null); }
public static SoftFluent.Samples.GED.Directory LoadById(System.Guid id) { if ((id.Equals(CodeFluentPersistence.DefaultGuidValue) == true)) { return(null); } SoftFluent.Samples.GED.Directory directory = new SoftFluent.Samples.GED.Directory(); CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Samples.GED.Constants.SoftFluent_Samples_GEDStoreName).Persistence; persistence.CreateStoredProcedureCommand(null, "Directory", "LoadById"); persistence.AddRawParameter("@Id", id); System.Data.IDataReader reader = null; try { reader = persistence.ExecuteReader(); if ((reader.Read() == true)) { directory.ReadRecord(reader, CodeFluent.Runtime.CodeFluentReloadOptions.Default); directory.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged; return(directory); } } finally { if ((reader != null)) { reader.Dispose(); } persistence.CompleteCommand(); } return(null); }
public static ContactManager.Contact LoadByEmail(string email) { if ((email == default(string))) { return(null); } ContactManager.Contact contact = new ContactManager.Contact(); CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(ContactManager.Constants.ContactManagerStoreName).Persistence; persistence.CreateStoredProcedureCommand(null, "Contact", "LoadByEmail"); persistence.AddParameter("@Email", email, default(string)); System.Data.IDataReader reader = null; try { reader = persistence.ExecuteReader(); if ((reader.Read() == true)) { contact.ReadRecord(reader, CodeFluent.Runtime.CodeFluentReloadOptions.Default); contact.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged; return(contact); } } finally { if ((reader != null)) { reader.Dispose(); } persistence.CompleteCommand(); } return(null); }
public static SoftFluent.Samples.AspNetIdentity1.ExternalLogin LoadByProviderKey(string providerKey) { if ((providerKey == default(string))) { return(null); } SoftFluent.Samples.AspNetIdentity1.ExternalLogin externalLogin = new SoftFluent.Samples.AspNetIdentity1.ExternalLogin(); CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Samples.AspNetIdentity1.Constants.SoftFluent_Samples_AspNetIdentity1StoreName).Persistence; persistence.CreateStoredProcedureCommand(null, "ExternalLogin", "LoadByProviderKey"); persistence.AddParameter("@ProviderKey", providerKey, default(string)); System.Data.IDataReader reader = null; try { reader = persistence.ExecuteReader(); if ((reader.Read() == true)) { externalLogin.ReadRecord(reader, CodeFluent.Runtime.CodeFluentReloadOptions.Default); externalLogin.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged; return(externalLogin); } } finally { if ((reader != null)) { reader.Dispose(); } persistence.CompleteCommand(); } return(null); }
public static SoftFluent.Json.NET.StockItem LoadById(int id) { if ((id == -1)) { return(null); } SoftFluent.Json.NET.StockItem stockItem = new SoftFluent.Json.NET.StockItem(); CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Json.NET.Constants.SoftFluent_Json_NETStoreName).Persistence; persistence.CreateStoredProcedureCommand(null, "StockItem", "LoadById"); persistence.AddParameter("@Id", id, ((int)(-1))); System.Data.IDataReader reader = null; try { reader = persistence.ExecuteReader(); if ((reader.Read() == true)) { stockItem.ReadRecord(reader, CodeFluent.Runtime.CodeFluentReloadOptions.Default); stockItem.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged; return(stockItem); } } finally { if ((reader != null)) { reader.Dispose(); } persistence.CompleteCommand(); } return(null); }
public static SoftFluent.SqlServerInMemory.ContactSource LoadById(int id) { if ((id == -1)) { return(null); } SoftFluent.SqlServerInMemory.ContactSource contactSource = new SoftFluent.SqlServerInMemory.ContactSource(); CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.SqlServerInMemory.Constants.SoftFluent_SqlServerInMemoryStoreName).Persistence; persistence.CreateStoredProcedureCommand(null, "ContactSource", "LoadById"); persistence.AddParameter("@Id", id, ((int)(-1))); System.Data.IDataReader reader = null; try { reader = persistence.ExecuteReader(); if ((reader.Read() == true)) { contactSource.ReadRecord(reader, CodeFluent.Runtime.CodeFluentReloadOptions.Default); contactSource.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged; return(contactSource); } } finally { if ((reader != null)) { reader.Dispose(); } persistence.CompleteCommand(); } return(null); }
public static SoftFluent.Samples.ExtendedSearch.Customer Load(int id) { if ((id == -1)) { return(null); } SoftFluent.Samples.ExtendedSearch.Customer customer = new SoftFluent.Samples.ExtendedSearch.Customer(); CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Samples.ExtendedSearch.Constants.SoftFluent_Samples_SearchStoreName).Persistence; persistence.CreateStoredProcedureCommand(null, "Customer", "Load"); persistence.AddParameter("@Id", id, ((int)(-1))); System.Data.IDataReader reader = null; try { reader = persistence.ExecuteReader(); if ((reader.Read() == true)) { customer.ReadRecord(reader, CodeFluent.Runtime.CodeFluentReloadOptions.Default); customer.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged; return(customer); } } finally { if ((reader != null)) { reader.Dispose(); } persistence.CompleteCommand(); } return(null); }
public static System.Data.IDataReader PageDataLoadByCardNumber(CodeFluent.Runtime.PageOptions pageOptions, string cardNumber) { if ((cardNumber == default(string))) { throw new System.ArgumentNullException("cardNumber"); } CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Samples.EncryptAspect.Constants.SoftFluent_Samples_EncryptAspectStoreName).Persistence; persistence.CreateStoredProcedureCommand(null, "Customer", "LoadByCardNumber"); persistence.AddParameter("@CardNumber", cardNumber, default(string)); persistence.AddParameter("@PassPhrase", SoftFluent.Samples.EncryptAspect.PassPhrase.GetPassPhrase(), default(string)); if ((pageOptions != null)) { System.Collections.IEnumerator enumerator = pageOptions.OrderByArguments.GetEnumerator(); bool b; int index = 0; for (b = enumerator.MoveNext(); b; b = enumerator.MoveNext()) { CodeFluent.Runtime.OrderByArgument argument = ((CodeFluent.Runtime.OrderByArgument)(enumerator.Current)); persistence.AddParameter(string.Format("@_orderBy{0}", index), argument.Name); persistence.AddParameter(string.Format("@_orderByDirection{0}", index), ((int)(argument.Direction))); index = (index + 1); } } System.Data.IDataReader reader = CodeFluentContext.Get(SoftFluent.Samples.EncryptAspect.Constants.SoftFluent_Samples_EncryptAspectStoreName).Persistence.ExecuteReader(); return(reader); }
public virtual bool Delete() { bool ret = false; CodeFluent.Runtime.CodeFluentEntityActionEventArgs evt = new CodeFluent.Runtime.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.Deleting, true); this.OnEntityAction(evt); if ((evt.Cancel == true)) { return(ret); } if ((this.EntityState == CodeFluent.Runtime.CodeFluentEntityState.Deleted)) { return(ret); } if ((this.RowVersion == null)) { return(ret); } CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Samples.Thinktecture.IdentityServer.Constants.SoftFluent_Samples_Thinktecture_IdentityServerStoreName).Persistence; persistence.CreateStoredProcedureCommand(null, "Role", "Delete"); persistence.AddParameter("@Role_Id", this.Id, CodeFluentPersistence.DefaultGuidValue); persistence.AddParameter("@_rowVersion", this.RowVersion); persistence.ExecuteNonQuery(); this.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Deleted; this.OnEntityAction(new CodeFluent.Runtime.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.Deleted, false, false)); ret = true; return(ret); }
public static SoftFluent.Samples.Thinktecture.IdentityServer.Role LoadByName(string name) { if ((name == default(string))) { return(null); } SoftFluent.Samples.Thinktecture.IdentityServer.Role role = new SoftFluent.Samples.Thinktecture.IdentityServer.Role(); CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Samples.Thinktecture.IdentityServer.Constants.SoftFluent_Samples_Thinktecture_IdentityServerStoreName).Persistence; persistence.CreateStoredProcedureCommand(null, "Role", "LoadByName"); persistence.AddParameter("@Name", name, default(string)); System.Data.IDataReader reader = null; try { reader = persistence.ExecuteReader(); if ((reader.Read() == true)) { role.ReadRecord(reader, CodeFluent.Runtime.CodeFluentReloadOptions.Default); role.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged; return(role); } } finally { if ((reader != null)) { reader.Dispose(); } persistence.CompleteCommand(); } return(null); }
public static System.Data.IDataReader PageDataLoadByUser(CodeFluent.Runtime.PageOptions pageOptions, SoftFluent.Samples.AspNetIdentity1.User user) { if ((user == null)) { return(null); } if ((user.Id == default(string))) { CodeFluent.Runtime.CodeFluentRuntimeException.Throw("invalidEntityKey", "Id", "user", "SoftFluent.Samples.AspNetIdentity1.User"); } CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Samples.AspNetIdentity1.Constants.SoftFluent_Samples_AspNetIdentity1StoreName).Persistence; persistence.CreateStoredProcedureCommand(null, "ExternalLogin", "LoadByUser"); persistence.AddParameter("@UserId", user.Id, default(string)); if ((pageOptions != null)) { System.Collections.IEnumerator enumerator = pageOptions.OrderByArguments.GetEnumerator(); bool b; int index = 0; for (b = enumerator.MoveNext(); b; b = enumerator.MoveNext()) { CodeFluent.Runtime.OrderByArgument argument = ((CodeFluent.Runtime.OrderByArgument)(enumerator.Current)); persistence.AddParameter(string.Format("@_orderBy{0}", index), argument.Name); persistence.AddParameter(string.Format("@_orderByDirection{0}", index), ((int)(argument.Direction))); index = (index + 1); } } System.Data.IDataReader reader = CodeFluentContext.Get(SoftFluent.Samples.AspNetIdentity1.Constants.SoftFluent_Samples_AspNetIdentity1StoreName).Persistence.ExecuteReader(); return(reader); }
public static SoftFluent.Samples.EncryptAspect.Customer LoadById(System.Guid id) { if ((id.Equals(CodeFluentPersistence.DefaultGuidValue) == true)) { return(null); } SoftFluent.Samples.EncryptAspect.Customer customer = new SoftFluent.Samples.EncryptAspect.Customer(); CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Samples.EncryptAspect.Constants.SoftFluent_Samples_EncryptAspectStoreName).Persistence; persistence.CreateStoredProcedureCommand(null, "Customer", "LoadById"); persistence.AddParameter("@Id", id, CodeFluentPersistence.DefaultGuidValue); persistence.AddParameter("@PassPhrase", SoftFluent.Samples.EncryptAspect.PassPhrase.GetPassPhrase(), default(string)); System.Data.IDataReader reader = null; try { reader = persistence.ExecuteReader(); if ((reader.Read() == true)) { customer.ReadRecord(reader, CodeFluent.Runtime.CodeFluentReloadOptions.Default); customer.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged; return(customer); } } finally { if ((reader != null)) { reader.Dispose(); } persistence.CompleteCommand(); } return(null); }
public static SoftFluent.Samples.Thinktecture.IdentityServer.Login LoadById(System.Guid id) { if ((id.Equals(CodeFluentPersistence.DefaultGuidValue) == true)) { return(null); } SoftFluent.Samples.Thinktecture.IdentityServer.Login login = new SoftFluent.Samples.Thinktecture.IdentityServer.Login(); CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Samples.Thinktecture.IdentityServer.Constants.SoftFluent_Samples_Thinktecture_IdentityServerStoreName).Persistence; persistence.CreateStoredProcedureCommand(null, "Login", "LoadById"); persistence.AddParameter("@Id", id, CodeFluentPersistence.DefaultGuidValue); System.Data.IDataReader reader = null; try { reader = persistence.ExecuteReader(); if ((reader.Read() == true)) { login.ReadRecord(reader, CodeFluent.Runtime.CodeFluentReloadOptions.Default); login.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged; return(login); } } finally { if ((reader != null)) { reader.Dispose(); } persistence.CompleteCommand(); } return(null); }
public static SoftFluent.Samples.AspNetIdentity2.Role Load(System.Guid id) { if ((id.Equals(CodeFluentPersistence.DefaultGuidValue) == true)) { return(null); } SoftFluent.Samples.AspNetIdentity2.Role role = new SoftFluent.Samples.AspNetIdentity2.Role(); CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Samples.AspNetIdentity2.Constants.SoftFluent_Samples_AspNetIdentity2StoreName).Persistence; persistence.CreateStoredProcedureCommand(null, "Role", "Load"); persistence.AddParameter("@Id", id, CodeFluentPersistence.DefaultGuidValue); System.Data.IDataReader reader = null; try { reader = persistence.ExecuteReader(); if ((reader.Read() == true)) { role.ReadRecord(reader, CodeFluent.Runtime.CodeFluentReloadOptions.Default); role.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged; return(role); } } finally { if ((reader != null)) { reader.Dispose(); } persistence.CompleteCommand(); } return(null); }
public virtual bool Delete() { bool ret = false; CodeFluent.Runtime.CodeFluentEntityActionEventArgs evt = new CodeFluent.Runtime.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.Deleting, true); this.OnEntityAction(evt); if ((evt.Cancel == true)) { return(ret); } if ((this.EntityState == CodeFluent.Runtime.CodeFluentEntityState.Deleted)) { return(ret); } if ((this.RowVersion == null)) { return(ret); } CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(ContactManager.Constants.ContactManagerStoreName).Persistence; persistence.CreateStoredProcedureCommand(null, "Address", "Delete"); persistence.AddParameter("@Address_Id", this.Id, ((int)(-1))); persistence.AddParameter("@_rowVersion", this.RowVersion); persistence.ExecuteNonQuery(); this.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Deleted; this.OnEntityAction(new CodeFluent.Runtime.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.Deleted, false, false)); ret = true; return(ret); }
public static ContactManager.Address LoadByContact(int contactId) { if ((contactId == -1)) { return(null); } ContactManager.Address address = new ContactManager.Address(); CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(ContactManager.Constants.ContactManagerStoreName).Persistence; persistence.CreateStoredProcedureCommand(null, "Address", "LoadByContact"); persistence.AddParameter("@ContactId", contactId); System.Data.IDataReader reader = null; try { reader = persistence.ExecuteReader(); if ((reader.Read() == true)) { address.ReadRecord(reader, CodeFluent.Runtime.CodeFluentReloadOptions.Default); address.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged; return(address); } } finally { if ((reader != null)) { reader.Dispose(); } persistence.CompleteCommand(); } return(null); }
public static SoftFluent.Samples.ComponentOne.User LoadByEmail(string email) { if ((email == default(string))) { return(null); } SoftFluent.Samples.ComponentOne.User user = new SoftFluent.Samples.ComponentOne.User(); CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Samples.ComponentOne.Constants.SoftFluent_Samples_ComponentOneStoreName).Persistence; persistence.CreateStoredProcedureCommand(null, "User", "LoadByEmail"); persistence.AddParameter("@Email", email, default(string)); System.Data.IDataReader reader = null; try { reader = persistence.ExecuteReader(); if ((reader.Read() == true)) { user.ReadRecord(reader, CodeFluent.Runtime.CodeFluentReloadOptions.Default); user.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged; return(user); } } finally { if ((reader != null)) { reader.Dispose(); } persistence.CompleteCommand(); } return(null); }
public static System.Data.IDataReader PageDataLoadByUser(CodeFluent.Runtime.PageOptions pageOptions, ModelCodeFluent.Identity.User user) { if ((user == null)) { return(null); } if ((user.Id.Equals(CodeFluentPersistence.DefaultGuidValue) == true)) { CodeFluent.Runtime.CodeFluentRuntimeException.Throw("invalidEntityKey", "Id", "user", "ModelCodeFluent.Identity.User"); } CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(ModelCodeFluent.Constants.ModelCodeFluentStoreName).Persistence; persistence.CreateStoredProcedureCommand(null, "UserClaim", "LoadByUser"); persistence.AddParameter("@UserId", user.Id, CodeFluentPersistence.DefaultGuidValue); if ((pageOptions != null)) { System.Collections.IEnumerator enumerator = pageOptions.OrderByArguments.GetEnumerator(); bool b; int index = 0; for (b = enumerator.MoveNext(); b; b = enumerator.MoveNext()) { CodeFluent.Runtime.OrderByArgument argument = ((CodeFluent.Runtime.OrderByArgument)(enumerator.Current)); persistence.AddParameter(string.Format("@_orderBy{0}", index), argument.Name); persistence.AddParameter(string.Format("@_orderByDirection{0}", index), ((int)(argument.Direction))); index = (index + 1); } } System.Data.IDataReader reader = CodeFluentContext.Get(ModelCodeFluent.Constants.ModelCodeFluentStoreName).Persistence.ExecuteReader(); return(reader); }
public static System.Data.IDataReader PageDataLoadByRole(CodeFluent.Runtime.PageOptions pageOptions, SoftFluent.Samples.GED.Security.Role role) { if ((role == null)) { return(null); } if ((role.Id.Equals(CodeFluentPersistence.DefaultGuidValue) == true)) { CodeFluent.Runtime.CodeFluentRuntimeException.Throw("invalidEntityKey", "Id", "role", "SoftFluent.Samples.GED.Security.Role"); } CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Samples.GED.Constants.SoftFluent_Samples_GEDStoreName).Persistence; persistence.CreateStoredProcedureCommand(null, "UserRole", "LoadByRole"); persistence.AddParameter("@RoleId", role.Id, CodeFluentPersistence.DefaultGuidValue); if ((pageOptions != null)) { System.Collections.IEnumerator enumerator = pageOptions.OrderByArguments.GetEnumerator(); bool b; int index = 0; for (b = enumerator.MoveNext(); b; b = enumerator.MoveNext()) { CodeFluent.Runtime.OrderByArgument argument = ((CodeFluent.Runtime.OrderByArgument)(enumerator.Current)); persistence.AddParameter(string.Format("@_orderBy{0}", index), argument.Name); persistence.AddParameter(string.Format("@_orderByDirection{0}", index), ((int)(argument.Direction))); index = (index + 1); } } System.Data.IDataReader reader = CodeFluentContext.Get(SoftFluent.Samples.GED.Constants.SoftFluent_Samples_GEDStoreName).Persistence.ExecuteReader(); return(reader); }
public virtual bool Delete() { bool ret = false; CodeFluent.Runtime.CodeFluentEntityActionEventArgs evt = new CodeFluent.Runtime.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.Deleting, true); this.OnEntityAction(evt); if ((evt.Cancel == true)) { return(ret); } if ((this.EntityState == CodeFluent.Runtime.CodeFluentEntityState.Deleted)) { return(ret); } if ((this.RowVersion == null)) { return(ret); } CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Samples.AspNetIdentity1.Constants.SoftFluent_Samples_AspNetIdentity1StoreName).Persistence; persistence.CreateStoredProcedureCommand(null, "ExternalLogin", "Delete"); persistence.AddParameter("@ExternalLogin_ProviderKey", this.ProviderKey, default(string)); persistence.AddParameter("@_rowVersion", this.RowVersion); persistence.ExecuteNonQuery(); this.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Deleted; this.OnEntityAction(new CodeFluent.Runtime.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.Deleted, false, false)); ret = true; return(ret); }
protected virtual bool BaseSave(bool force) { if ((this.EntityState == CodeFluent.Runtime.CodeFluentEntityState.ToBeDeleted)) { this.Delete(); return(false); } CodeFluent.Runtime.CodeFluentEntityActionEventArgs evt = new CodeFluent.Runtime.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.Saving, true); this.OnEntityAction(evt); if ((evt.Cancel == true)) { return(false); } CodeFluentPersistence.ThrowIfDeleted(this); this.Validate(); if (((force == false) && (this.EntityState == CodeFluent.Runtime.CodeFluentEntityState.Unchanged))) { return(false); } CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Json.NET.Constants.SoftFluent_Json_NETStoreName).Persistence; persistence.CreateStoredProcedureCommand(null, "Customer", "Save"); persistence.AddParameter("@Customer_Id", this.Id, ((int)(-1))); persistence.AddParameter("@Customer_Name", this.Name, default(string)); persistence.AddParameter("@Customer_Address", this.Address, default(string)); persistence.AddParameter("@Customer_City", this.City, default(string)); persistence.AddParameter("@Customer_ZipCode", this.ZipCode, default(string)); persistence.AddParameter("@Customer_Country", this.Country, default(string)); persistence.AddParameter("@Customer_Phone", this.Phone, default(string)); persistence.AddParameter("@Customer_Fax", this.Fax, default(string)); persistence.AddParameter("@Customer_WebSite", this.WebSite, default(string)); persistence.AddParameterEnumInt32("@Customer_Language", this.Language, SoftFluent.Json.NET.Language.French); persistence.AddParameterEnumInt32("@Customer_CustomerType", this.CustomerType, SoftFluent.Json.NET.CustomerType.Client); persistence.AddParameter("@_trackLastWriteUser", persistence.Context.User.Name); persistence.AddParameter("@_rowVersion", this.RowVersion); System.Data.IDataReader reader = null; try { reader = persistence.ExecuteReader(); if ((reader.Read() == true)) { this.ReadRecordOnSave(reader); } CodeFluentPersistence.NextResults(reader); } finally { if ((reader != null)) { reader.Dispose(); } persistence.CompleteCommand(); } this.OnEntityAction(new CodeFluent.Runtime.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.Saved, false, false)); this.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged; return(true); }
protected virtual bool BaseSave(bool force) { if ((this.EntityState == CodeFluent.Runtime.CodeFluentEntityState.ToBeDeleted)) { this.Delete(); return(false); } CodeFluent.Runtime.CodeFluentEntityActionEventArgs evt = new CodeFluent.Runtime.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.Saving, true); this.OnEntityAction(evt); if ((evt.Cancel == true)) { return(false); } CodeFluentPersistence.ThrowIfDeleted(this); this.Validate(); if (((force == false) && (this.EntityState == CodeFluent.Runtime.CodeFluentEntityState.Unchanged))) { return(false); } CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Json.NET.Constants.SoftFluent_Json_NETStoreName).Persistence; persistence.CreateStoredProcedureCommand(null, "Campaign", "Save"); persistence.AddParameter("@Campaign_Id", this.Id, ((int)(-1))); persistence.AddParameter("@Campaign_Name", this.Name, default(string)); persistence.AddParameterEnumInt32("@Campaign_State", this.State, SoftFluent.Json.NET.CampaignStateType.Conceived); persistence.AddParameter("@Campaign_Customer_Id", this.CustomerId, ((int)(-1))); persistence.AddParameter("@Campaign_Price", this.Price, CodeFluentPersistence.DefaultDecimalValue); persistence.AddParameter("@Campaign_PriceAllTaxIncluded", this.PriceAllTaxIncluded, CodeFluentPersistence.DefaultDecimalValue); persistence.AddParameter("@Campaign_DiscountRate", this.DiscountRate, CodeFluentPersistence.DefaultDecimalValue); persistence.AddParameter("@Campaign_ConceptionDate", this.ConceptionDate, CodeFluentPersistence.DefaultDateTimeValue); persistence.AddParameter("@Campaign_AddressedDate", this.AddressedDate, CodeFluentPersistence.DefaultDateTimeValue); persistence.AddParameter("@Campaign_PropositionDate", this.PropositionDate, CodeFluentPersistence.DefaultDateTimeValue); persistence.AddParameter("@Campaign_ConfirmationDate", this.ConfirmationDate, CodeFluentPersistence.DefaultDateTimeValue); persistence.AddParameter("@_trackLastWriteUser", persistence.Context.User.Name); persistence.AddParameter("@_rowVersion", this.RowVersion); System.Data.IDataReader reader = null; try { reader = persistence.ExecuteReader(); if ((reader.Read() == true)) { this.ReadRecordOnSave(reader); } CodeFluentPersistence.NextResults(reader); } finally { if ((reader != null)) { reader.Dispose(); } persistence.CompleteCommand(); } this.OnEntityAction(new CodeFluent.Runtime.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.Saved, false, false)); this.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged; return(true); }
protected virtual bool BaseSave(bool force) { if ((this.EntityState == CodeFluent.Runtime.CodeFluentEntityState.ToBeDeleted)) { this.Delete(); return(false); } CodeFluent.Runtime.CodeFluentEntityActionEventArgs evt = new CodeFluent.Runtime.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.Saving, true); this.OnEntityAction(evt); if ((evt.Cancel == true)) { return(false); } CodeFluentPersistence.ThrowIfDeleted(this); this.Validate(); if (((force == false) && (this.EntityState == CodeFluent.Runtime.CodeFluentEntityState.Unchanged))) { return(false); } CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Samples.GED.Constants.SoftFluent_Samples_GEDStoreName).Persistence; persistence.CreateStoredProcedureCommand(null, "Document", "Save"); persistence.AddParameter("@Document_Id", this.Id, CodeFluentPersistence.DefaultGuidValue); persistence.AddParameter("@Document_Text", this.Text, default(string)); persistence.AddParameter("@Document_User_Id", this.UserId, CodeFluentPersistence.DefaultGuidValue); persistence.AddParameter("@Document_Title", this.Title, default(string)); persistence.AddParameter("@Document_Directory_Id", this.DirectoryId, CodeFluentPersistence.DefaultGuidValue); persistence.AddParameter("@Document_Reference", this.Reference, default(string)); persistence.AddParameter("@Document_Token", this.Token, default(string)); persistence.AddRawParameter("@Document_IsProcessed", this.IsProcessed); persistence.AddRawParameter("@Document_IsReady", this.IsReady); persistence.AddParameter("@_trackLastWriteUser", persistence.Context.User.Name); persistence.AddParameter("@_rowVersion", this.RowVersion); System.Data.IDataReader reader = null; try { reader = persistence.ExecuteReader(); if ((reader.Read() == true)) { this.ReadRecordOnSave(reader); } CodeFluentPersistence.NextResults(reader); } finally { if ((reader != null)) { reader.Dispose(); } persistence.CompleteCommand(); } this.OnEntityAction(new CodeFluent.Runtime.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.Saved, false, false)); this.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged; return(true); }