Esempio n. 1
0
 protected virtual void ReadRecord(System.Data.IDataReader reader, CodeFluent.Runtime.CodeFluentReloadOptions options)
 {
     if ((reader == null))
     {
         throw new System.ArgumentNullException("reader");
     }
     if ((((options & CodeFluent.Runtime.CodeFluentReloadOptions.Properties)
           == 0)
          == false))
     {
         this._id       = CodeFluentPersistence.GetReaderValue(reader, "Address_Id", ((int)(-1)));
         this._line1    = CodeFluentPersistence.GetReaderValue(reader, "Address_Line1", ((string)(default(string))));
         this._line2    = CodeFluentPersistence.GetReaderValue(reader, "Address_Line2", ((string)(default(string))));
         this._city     = CodeFluentPersistence.GetReaderValue(reader, "Address_City", ((string)(default(string))));
         this._zip      = CodeFluentPersistence.GetReaderValue(reader, "Address_Zip", ((string)(default(string))));
         this._country  = CodeFluentPersistence.GetReaderValue(reader, "Address_Country", ((string)(default(string))));
         this.ContactId = CodeFluentPersistence.GetReaderValue(reader, "Address_Contact_Id", ((int)(-1)));
     }
     if ((((options & CodeFluent.Runtime.CodeFluentReloadOptions.RowVersion)
           == 0)
          == false))
     {
         this._rowVersion = CodeFluentPersistence.GetReaderValue(reader, "_rowVersion", ((byte[])(null)));
     }
     this.OnEntityAction(new CodeFluent.Runtime.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.ReadRecord, false, false));
 }
Esempio n. 2
0
 public virtual void ValidateLocal(System.Globalization.CultureInfo culture, System.Collections.Generic.IList <CodeFluent.Runtime.CodeFluentValidationException> results)
 {
     CodeFluent.Runtime.ServiceModel.CodeFluentEntityActionEventArgs evt = new CodeFluent.Runtime.ServiceModel.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.Validating, true, results);
     evt.Culture = culture;
     this.OnEntityAction(evt);
     if ((evt.Cancel == true))
     {
         string externalValidate;
         if ((evt.Argument != null))
         {
             externalValidate = evt.Argument.ToString();
         }
         else
         {
             externalValidate = SoftFluent.Samples.SignalR.Proxy.Resources.Manager.GetStringWithDefault(culture, "SoftFluent.Samples.SignalR.Proxy.Customer.ExternalValidate", "Type \'SoftFluent.Samples.SignalR.Customer\' cannot be validated.", null);
         }
         CodeFluentPersistence.AddValidationError(results, externalValidate);
     }
     CodeFluentPersistence.ValidateMember(culture, results, this, null);
     if ((this.Id.Equals(CodeFluentPersistence.DefaultGuidValue) == true))
     {
         string localValidate = SoftFluent.Samples.SignalR.Proxy.Resources.Manager.GetStringWithDefault(culture, "SoftFluent.Samples.SignalR.Proxy.Customer.Id.NullException", "\'Id\' property cannot be set to \'00000000-0000-0000-0000-000000000000\' for type \'S" +
                                                                                                        "oftFluent.Samples.SignalR.Customer\'", null);
         CodeFluentPersistence.AddValidationError(results, localValidate);
     }
     this.OnEntityAction(new CodeFluent.Runtime.ServiceModel.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.Validated, false, results));
 }
 protected virtual void ReadRecord(System.Data.IDataReader reader, CodeFluent.Runtime.CodeFluentReloadOptions options)
 {
     if ((reader == null))
     {
         throw new System.ArgumentNullException("reader");
     }
     if ((((options & CodeFluent.Runtime.CodeFluentReloadOptions.Properties)
           == 0)
          == false))
     {
         this._id             = CodeFluentPersistence.GetReaderValue(reader, "Contact_Id", ((int)(-1)));
         this._email          = CodeFluentPersistence.GetReaderValue(reader, "Contact_Email", ((string)(default(string))));
         this._firstName      = CodeFluentPersistence.GetReaderValue(reader, "Contact_FirstName", ((string)(default(string))));
         this._lastName       = CodeFluentPersistence.GetReaderValue(reader, "Contact_LastName", ((string)(default(string))));
         this.ContactSourceId = CodeFluentPersistence.GetReaderValue(reader, "Contact_ContactSource_Id", ((int)(-1)));
         this._status         = ((ContactManager.Status)(CodeFluentPersistence.GetReaderValueEnum(reader, "Contact_Status", ((ContactManager.Status)(ContactManager.Status.Valid)))));
         this.AddressId       = CodeFluentPersistence.GetReaderValue(reader, "Contact_Address_Id", ((int)(-1)));
         this.UserId          = CodeFluentPersistence.GetReaderValue(reader, "Contact_User_Id", ((int)(-1)));
         this._description    = CodeFluentPersistence.GetReaderValue(reader, "Contact_Description", ((string)(default(string))));
     }
     if ((((options & CodeFluent.Runtime.CodeFluentReloadOptions.RowVersion)
           == 0)
          == false))
     {
         this._rowVersion = CodeFluentPersistence.GetReaderValue(reader, "_rowVersion", ((byte[])(null)));
     }
     this.OnEntityAction(new CodeFluent.Runtime.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.ReadRecord, false, false));
 }
Esempio n. 4
0
 protected virtual void ReadRecord(System.Data.IDataReader reader, CodeFluent.Runtime.CodeFluentReloadOptions options)
 {
     if ((reader == null))
     {
         throw new System.ArgumentNullException("reader");
     }
     if ((((options & CodeFluent.Runtime.CodeFluentReloadOptions.Properties)
           == 0)
          == false))
     {
         this._id                  = CodeFluentPersistence.GetReaderValue(reader, "Campaign_Id", ((int)(-1)));
         this._name                = CodeFluentPersistence.GetReaderValue(reader, "Campaign_Name", ((string)(default(string))));
         this._state               = ((SoftFluent.Json.NET.CampaignStateType)(CodeFluentPersistence.GetReaderValueEnum(reader, "Campaign_State", ((SoftFluent.Json.NET.CampaignStateType)(SoftFluent.Json.NET.CampaignStateType.Conceived)))));
         this.CustomerId           = CodeFluentPersistence.GetReaderValue(reader, "Campaign_Customer_Id", ((int)(-1)));
         this._price               = CodeFluentPersistence.GetReaderValue(reader, "Campaign_Price", ((decimal)(CodeFluentPersistence.DefaultDecimalValue)));
         this._priceAllTaxIncluded = CodeFluentPersistence.GetReaderValue(reader, "Campaign_PriceAllTaxIncluded", ((decimal)(CodeFluentPersistence.DefaultDecimalValue)));
         this._discountRate        = CodeFluentPersistence.GetReaderValue(reader, "Campaign_DiscountRate", ((decimal)(CodeFluentPersistence.DefaultDecimalValue)));
         this._conceptionDate      = CodeFluentPersistence.GetReaderValue(reader, "Campaign_ConceptionDate", ((System.DateTime)(CodeFluentPersistence.DefaultDateTimeValue)));
         this._addressedDate       = CodeFluentPersistence.GetReaderValue(reader, "Campaign_AddressedDate", ((System.DateTime)(CodeFluentPersistence.DefaultDateTimeValue)));
         this._propositionDate     = CodeFluentPersistence.GetReaderValue(reader, "Campaign_PropositionDate", ((System.DateTime)(CodeFluentPersistence.DefaultDateTimeValue)));
         this._confirmationDate    = CodeFluentPersistence.GetReaderValue(reader, "Campaign_ConfirmationDate", ((System.DateTime)(CodeFluentPersistence.DefaultDateTimeValue)));
     }
     if ((((options & CodeFluent.Runtime.CodeFluentReloadOptions.RowVersion)
           == 0)
          == false))
     {
         this._rowVersion = CodeFluentPersistence.GetReaderValue(reader, "_rowVersion", ((byte[])(null)));
     }
     this.OnEntityAction(new CodeFluent.Runtime.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.ReadRecord, false, false));
 }
Esempio n. 5
0
 protected virtual void ReadRecord(System.Data.IDataReader reader, CodeFluent.Runtime.CodeFluentReloadOptions options)
 {
     if ((reader == null))
     {
         throw new System.ArgumentNullException("reader");
     }
     if ((((options & CodeFluent.Runtime.CodeFluentReloadOptions.Properties)
           == 0)
          == false))
     {
         this._id           = CodeFluentPersistence.GetReaderValue(reader, "Customer_Id", ((int)(-1)));
         this._name         = CodeFluentPersistence.GetReaderValue(reader, "Customer_Name", ((string)(default(string))));
         this._address      = CodeFluentPersistence.GetReaderValue(reader, "Customer_Address", ((string)(default(string))));
         this._city         = CodeFluentPersistence.GetReaderValue(reader, "Customer_City", ((string)(default(string))));
         this._zipCode      = CodeFluentPersistence.GetReaderValue(reader, "Customer_ZipCode", ((string)(default(string))));
         this._country      = CodeFluentPersistence.GetReaderValue(reader, "Customer_Country", ((string)(default(string))));
         this._phone        = CodeFluentPersistence.GetReaderValue(reader, "Customer_Phone", ((string)(default(string))));
         this._fax          = CodeFluentPersistence.GetReaderValue(reader, "Customer_Fax", ((string)(default(string))));
         this._webSite      = CodeFluentPersistence.GetReaderValue(reader, "Customer_WebSite", ((string)(default(string))));
         this._language     = ((SoftFluent.Json.NET.Language)(CodeFluentPersistence.GetReaderValueEnum(reader, "Customer_Language", ((SoftFluent.Json.NET.Language)(SoftFluent.Json.NET.Language.French)))));
         this._customerType = ((SoftFluent.Json.NET.CustomerType)(CodeFluentPersistence.GetReaderValueEnum(reader, "Customer_CustomerType", ((SoftFluent.Json.NET.CustomerType)(SoftFluent.Json.NET.CustomerType.Client)))));
     }
     if ((((options & CodeFluent.Runtime.CodeFluentReloadOptions.RowVersion)
           == 0)
          == false))
     {
         this._rowVersion = CodeFluentPersistence.GetReaderValue(reader, "_rowVersion", ((byte[])(null)));
     }
     this.OnEntityAction(new CodeFluent.Runtime.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.ReadRecord, false, false));
 }
Esempio n. 6
0
 protected virtual void ReadRecord(System.Data.IDataReader reader, CodeFluent.Runtime.CodeFluentReloadOptions options)
 {
     if ((reader == null))
     {
         throw new System.ArgumentNullException("reader");
     }
     if ((((options & CodeFluent.Runtime.CodeFluentReloadOptions.Properties)
           == 0)
          == false))
     {
         this._id          = CodeFluentPersistence.GetReaderValue(reader, "Document_Id", ((System.Guid)(CodeFluentPersistence.DefaultGuidValue)));
         this._text        = CodeFluentPersistence.GetReaderValue(reader, "Document_Text", ((string)(default(string))));
         this.UserId       = CodeFluentPersistence.GetReaderValue(reader, "Document_User_Id", ((System.Guid)(CodeFluentPersistence.DefaultGuidValue)));
         this._title       = CodeFluentPersistence.GetReaderValue(reader, "Document_Title", ((string)(default(string))));
         this.DirectoryId  = CodeFluentPersistence.GetReaderValue(reader, "Document_Directory_Id", ((System.Guid)(CodeFluentPersistence.DefaultGuidValue)));
         this._reference   = CodeFluentPersistence.GetReaderValue(reader, "Document_Reference", ((string)(default(string))));
         this._token       = CodeFluentPersistence.GetReaderValue(reader, "Document_Token", ((string)(default(string))));
         this._isProcessed = CodeFluentPersistence.GetReaderValue(reader, "Document_IsProcessed", ((bool)(CodeFluentPersistence.DefaultBooleanValue)));
         this._isReady     = CodeFluentPersistence.GetReaderValue(reader, "Document_IsReady", ((bool)(CodeFluentPersistence.DefaultBooleanValue)));
     }
     if ((((options & CodeFluent.Runtime.CodeFluentReloadOptions.RowVersion)
           == 0)
          == false))
     {
         this._rowVersion = CodeFluentPersistence.GetReaderValue(reader, "_rowVersion", ((byte[])(null)));
     }
     this.OnEntityAction(new CodeFluent.Runtime.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.ReadRecord, false, false));
 }
Esempio n. 7
0
 protected virtual void ReadRecord(System.Data.IDataReader reader, CodeFluent.Runtime.CodeFluentReloadOptions options)
 {
     if ((reader == null))
     {
         throw new System.ArgumentNullException("reader");
     }
     if ((((options & CodeFluent.Runtime.CodeFluentReloadOptions.Properties)
           == 0)
          == false))
     {
         this._id             = CodeFluentPersistence.GetReaderValue(reader, "UserClaim_Id", ((System.Guid)(CodeFluentPersistence.DefaultGuidValue)));
         this._type           = CodeFluentPersistence.GetReaderValue(reader, "UserClaim_Type", ((string)(default(string))));
         this._value          = CodeFluentPersistence.GetReaderValue(reader, "UserClaim_Value", ((string)(default(string))));
         this._valueType      = CodeFluentPersistence.GetReaderValue(reader, "UserClaim_ValueType", ((string)(default(string))));
         this._issuer         = CodeFluentPersistence.GetReaderValue(reader, "UserClaim_Issuer", ((string)(default(string))));
         this._originalIssuer = CodeFluentPersistence.GetReaderValue(reader, "UserClaim_OriginalIssuer", ((string)(default(string))));
         this.UserId          = CodeFluentPersistence.GetReaderValue(reader, "UserClaim_User_Id", ((System.Guid)(CodeFluentPersistence.DefaultGuidValue)));
     }
     if ((((options & CodeFluent.Runtime.CodeFluentReloadOptions.RowVersion)
           == 0)
          == false))
     {
         this._rowVersion = CodeFluentPersistence.GetReaderValue(reader, "_rowVersion", ((byte[])(null)));
     }
     this.OnEntityAction(new CodeFluent.Runtime.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.ReadRecord, false, false));
 }
Esempio n. 8
0
 protected virtual void ReadRecord(System.Data.IDataReader reader, CodeFluent.Runtime.CodeFluentReloadOptions options)
 {
     if ((reader == null))
     {
         throw new System.ArgumentNullException("reader");
     }
     if ((((options & CodeFluent.Runtime.CodeFluentReloadOptions.Properties)
           == 0)
          == false))
     {
         this._id          = CodeFluentPersistence.GetReaderValue(reader, "Space_Id", ((int)(-1)));
         this._name        = CodeFluentPersistence.GetReaderValue(reader, "Space_Name", ((string)(default(string))));
         this._description = CodeFluentPersistence.GetReaderValue(reader, "Space_Description", ((string)(default(string))));
         this._width       = CodeFluentPersistence.GetReaderValue(reader, "Space_Width", ((float)(CodeFluentPersistence.DefaultSingleValue)));
         this._height      = CodeFluentPersistence.GetReaderValue(reader, "Space_Height", ((float)(CodeFluentPersistence.DefaultSingleValue)));
         this._tVA         = CodeFluentPersistence.GetReaderValue(reader, "Space_TVA", ((float)(CodeFluentPersistence.DefaultSingleValue)));
         this._price       = CodeFluentPersistence.GetReaderValue(reader, "Space_Price", ((decimal)(CodeFluentPersistence.DefaultDecimalValue)));
     }
     if ((((options & CodeFluent.Runtime.CodeFluentReloadOptions.RowVersion)
           == 0)
          == false))
     {
         this._rowVersion = CodeFluentPersistence.GetReaderValue(reader, "_rowVersion", ((byte[])(null)));
     }
     this.OnEntityAction(new CodeFluent.Runtime.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.ReadRecord, false, false));
 }
Esempio n. 9
0
 public virtual void Validate(System.Globalization.CultureInfo culture, System.Collections.Generic.IList <CodeFluent.Runtime.CodeFluentValidationException> results)
 {
     CodeFluent.Runtime.CodeFluentEntityActionEventArgs evt = new CodeFluent.Runtime.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.Validating, true, results);
     evt.Culture = culture;
     this.OnEntityAction(evt);
     if ((evt.Cancel == true))
     {
         string externalValidate;
         if ((evt.Argument != null))
         {
             externalValidate = evt.Argument.ToString();
         }
         else
         {
             externalValidate = SoftFluent.Json.NET.Resources.Manager.GetStringWithDefault(culture, "SoftFluent.Json.NET.Support.ExternalValidate", "Type \'SoftFluent.Json.NET.Support\' cannot be validated.", null);
         }
         CodeFluentPersistence.AddValidationError(results, externalValidate);
     }
     CodeFluentPersistence.ValidateMember(culture, results, this, null);
     if ((this.Name == default(string)))
     {
         string localValidate = SoftFluent.Json.NET.Resources.Manager.GetStringWithDefault(culture, "SoftFluent.Json.NET.Support.Name.NullException", "\'Name\' property cannot be set to \'\' for type \'SoftFluent.Json.NET.Support\'", null);
         CodeFluentPersistence.AddValidationError(results, localValidate);
     }
     this.OnEntityAction(new CodeFluent.Runtime.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.Validated, false, results));
 }
Esempio n. 10
0
 string System.ComponentModel.IDataErrorInfo.this[string columnName]
 {
     get
     {
         return(CodeFluentPersistence.ValidateMember(System.Globalization.CultureInfo.CurrentCulture, this, columnName, null));
     }
 }
Esempio n. 11
0
 protected virtual void ReadRecord(System.Data.IDataReader reader, CodeFluent.Runtime.CodeFluentReloadOptions options)
 {
     if ((reader == null))
     {
         throw new System.ArgumentNullException("reader");
     }
     if ((((options & CodeFluent.Runtime.CodeFluentReloadOptions.Properties)
           == 0)
          == false))
     {
         this._id = CodeFluentPersistence.GetReaderValue(reader, "User_Id", ((int)(-1)));
         this.BinaryLargeObjectsReset();
         this._email     = CodeFluentPersistence.GetReaderValue(reader, "User_Email", ((string)(default(string))));
         this._firstName = CodeFluentPersistence.GetReaderValue(reader, "User_FirstName", ((string)(default(string))));
         this._lastName  = CodeFluentPersistence.GetReaderValue(reader, "User_LastName", ((string)(default(string))));
         this.Photo.LoadMetaData(reader);
     }
     if ((((options & CodeFluent.Runtime.CodeFluentReloadOptions.RowVersion)
           == 0)
          == false))
     {
         this._rowVersion = CodeFluentPersistence.GetReaderValue(reader, "_rowVersion", ((byte[])(null)));
     }
     this.OnEntityAction(new CodeFluent.Runtime.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.ReadRecord, false, false));
 }
Esempio n. 12
0
 public virtual void Validate(System.Globalization.CultureInfo culture, System.Collections.Generic.IList <CodeFluent.Runtime.CodeFluentValidationException> results)
 {
     CodeFluent.Runtime.CodeFluentEntityActionEventArgs evt = new CodeFluent.Runtime.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.Validating, true, results);
     evt.Culture = culture;
     this.OnEntityAction(evt);
     if ((evt.Cancel == true))
     {
         string externalValidate;
         if ((evt.Argument != null))
         {
             externalValidate = evt.Argument.ToString();
         }
         else
         {
             externalValidate = SoftFluent.Samples.AspNetIdentity1.Resources.Manager.GetStringWithDefault(culture, "SoftFluent.Samples.AspNetIdentity1.ExternalLogin.ExternalValidate", "Type \'SoftFluent.Samples.AspNetIdentity1.ExternalLogin\' cannot be validated.", null);
         }
         CodeFluentPersistence.AddValidationError(results, externalValidate);
     }
     CodeFluentPersistence.ValidateMember(culture, results, this, null);
     if ((this.ProviderKey == default(string)))
     {
         string localValidate = SoftFluent.Samples.AspNetIdentity1.Resources.Manager.GetStringWithDefault(culture, "SoftFluent.Samples.AspNetIdentity1.ExternalLogin.ProviderKey.NullException", "\'ProviderKey\' property cannot be set to \'\' for type \'SoftFluent.Samples.AspNetIde" +
                                                                                                          "ntity1.ExternalLogin\'", null);
         CodeFluentPersistence.AddValidationError(results, localValidate);
     }
     if ((this.User == null))
     {
         string localValidate1 = SoftFluent.Samples.AspNetIdentity1.Resources.Manager.GetStringWithDefault(culture, "SoftFluent.Samples.AspNetIdentity1.ExternalLogin.User.NullException", "\'User\' property cannot be set to \'\' for type \'SoftFluent.Samples.AspNetIdentity1." +
                                                                                                           "ExternalLogin\'", null);
         CodeFluentPersistence.AddValidationError(results, localValidate1);
     }
     this.OnEntityAction(new CodeFluent.Runtime.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.Validated, false, results));
 }
Esempio n. 13
0
 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);
 }
Esempio n. 14
0
 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);
 }
Esempio n. 15
0
 protected virtual void ReadRecordOnSave(System.Data.IDataReader reader)
 {
     if ((reader == null))
     {
         throw new System.ArgumentNullException("reader");
     }
     this._rowVersion = CodeFluentPersistence.GetReaderValue(reader, "_rowVersion", ((byte[])(null)));
     this.OnEntityAction(new CodeFluent.Runtime.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.ReadRecordOnSave, false, false));
 }
Esempio n. 16
0
 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);
 }
Esempio n. 17
0
 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(ContactManager.Constants.ContactManagerStoreName).Persistence;
     persistence.CreateStoredProcedureCommand(null, "Contact", "Save");
     persistence.AddParameter("@Contact_Id", this.Id, ((int)(-1)));
     persistence.AddParameter("@Contact_Email", this.Email, default(string));
     persistence.AddParameter("@Contact_FirstName", this.FirstName, default(string));
     persistence.AddParameter("@Contact_LastName", this.LastName, default(string));
     persistence.AddParameter("@Contact_ContactSource_Id", this.ContactSourceId, ((int)(-1)));
     persistence.AddParameterEnumInt32("@Contact_Status", this.Status, ContactManager.Status.Valid);
     persistence.AddParameter("@Contact_Address_Id", this.AddressId, ((int)(-1)));
     persistence.AddParameter("@Contact_User_Id", this.UserId, ((int)(-1)));
     persistence.AddParameter("@Contact_Description", this.Description, default(string));
     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);
 }
Esempio n. 18
0
 protected virtual void ReadRecordOnSave(System.Data.IDataReader reader)
 {
     if ((reader == null))
     {
         throw new System.ArgumentNullException("reader");
     }
     this._name         = CodeFluentPersistence.GetReaderValue(reader, "Customer_Name", ((string)(default(string))));
     this._creationTime = CodeFluentPersistence.GetReaderValue(reader, "CreationTime", ((System.DateTime)(CodeFluentPersistence.DefaultDateTimeValue)));
     this._rowVersion   = CodeFluentPersistence.GetReaderValue(reader, "_rowVersion", ((byte[])(null)));
     this.OnEntityAction(new CodeFluent.Runtime.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.ReadRecordOnSave, false, false));
 }
Esempio n. 19
0
 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, "Space", "Save");
     persistence.AddParameter("@Space_Id", this.Id, ((int)(-1)));
     persistence.AddParameter("@Space_Name", this.Name, default(string));
     persistence.AddParameter("@Space_Description", this.Description, default(string));
     persistence.AddParameter("@Space_Width", this.Width, CodeFluentPersistence.DefaultSingleValue);
     persistence.AddParameter("@Space_Height", this.Height, CodeFluentPersistence.DefaultSingleValue);
     persistence.AddParameter("@Space_TVA", this.TVA, CodeFluentPersistence.DefaultSingleValue);
     persistence.AddParameter("@Space_Price", this.Price, CodeFluentPersistence.DefaultDecimalValue);
     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.SaveSupportRelations();
     this.OnEntityAction(new CodeFluent.Runtime.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.Saved, false, false));
     this.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged;
     return(true);
 }
Esempio n. 20
0
 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.ComponentOne.Constants.SoftFluent_Samples_ComponentOneStoreName).Persistence;
     persistence.CreateStoredProcedureCommand(null, "User", "Save");
     persistence.AddParameter("@User_Id", this.Id, CodeFluentPersistence.DefaultGuidValue);
     persistence.AddParameter("@User_Email", this.Email, default(string));
     persistence.AddParameter("@User_FirstName", this.FirstName, default(string));
     persistence.AddParameter("@User_LastName", this.LastName, default(string));
     persistence.AddParameter("@_trackLastWriteUser", persistence.Context.User.Name);
     persistence.AddParameter("@_rowVersion", this.RowVersion);
     if ((this._photo != null))
     {
         this._photo.SaveMetaData(persistence.Context);
     }
     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);
 }
Esempio n. 21
0
 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(ModelCodeFluent.Constants.ModelCodeFluentStoreName).Persistence;
     persistence.CreateStoredProcedureCommand(null, "UserClaim", "Save");
     persistence.AddParameter("@UserClaim_Id", this.Id, CodeFluentPersistence.DefaultGuidValue);
     persistence.AddParameter("@UserClaim_Type", this.Type, default(string));
     persistence.AddParameter("@UserClaim_Value", this.Value, default(string));
     persistence.AddParameter("@UserClaim_ValueType", this.ValueType, default(string));
     persistence.AddParameter("@UserClaim_Issuer", this.Issuer, default(string));
     persistence.AddParameter("@UserClaim_OriginalIssuer", this.OriginalIssuer, default(string));
     persistence.AddParameter("@UserClaim_User_Id", this.UserId, CodeFluentPersistence.DefaultGuidValue);
     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);
 }
Esempio n. 22
0
 public virtual void Validate(System.Globalization.CultureInfo culture, System.Collections.Generic.IList <CodeFluent.Runtime.CodeFluentValidationException> results)
 {
     CodeFluent.Runtime.CodeFluentEntityActionEventArgs evt = new CodeFluent.Runtime.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.Validating, true, results);
     evt.Culture = culture;
     this.OnEntityAction(evt);
     if ((evt.Cancel == true))
     {
         string externalValidate;
         if ((evt.Argument != null))
         {
             externalValidate = evt.Argument.ToString();
         }
         else
         {
             externalValidate = ModelCodeFluent.Resources.Manager.GetStringWithDefault(culture, "ModelCodeFluent.Identity.UserLogin.ExternalValidate", "Type \'ModelCodeFluent.Identity.UserLogin\' cannot be validated.", null);
         }
         CodeFluentPersistence.AddValidationError(results, externalValidate);
     }
     CodeFluentPersistence.ValidateMember(culture, results, this, null);
     if ((this.Id.Equals(CodeFluentPersistence.DefaultGuidValue) == true))
     {
         string localValidate = ModelCodeFluent.Resources.Manager.GetStringWithDefault(culture, "ModelCodeFluent.Identity.UserLogin.Id.NullException", "\'Id\' property cannot be set to \'00000000-0000-0000-0000-000000000000\' for type \'M" +
                                                                                       "odelCodeFluent.Identity.UserLogin\'", null);
         CodeFluentPersistence.AddValidationError(results, localValidate);
     }
     if ((this.ProviderName == default(string)))
     {
         string localValidate1 = ModelCodeFluent.Resources.Manager.GetStringWithDefault(culture, "ModelCodeFluent.Identity.UserLogin.ProviderName.NullException", "\'ProviderName\' property cannot be set to \'\' for type \'ModelCodeFluent.Identity.Us" +
                                                                                        "erLogin\'", null);
         CodeFluentPersistence.AddValidationError(results, localValidate1);
     }
     if ((this.ProviderKey == default(string)))
     {
         string localValidate2 = ModelCodeFluent.Resources.Manager.GetStringWithDefault(culture, "ModelCodeFluent.Identity.UserLogin.ProviderKey.NullException", "\'ProviderKey\' property cannot be set to \'\' for type \'ModelCodeFluent.Identity.Use" +
                                                                                        "rLogin\'", null);
         CodeFluentPersistence.AddValidationError(results, localValidate2);
     }
     if ((this.ProviderDisplayName == default(string)))
     {
         string localValidate3 = ModelCodeFluent.Resources.Manager.GetStringWithDefault(culture, "ModelCodeFluent.Identity.UserLogin.ProviderDisplayName.NullException", "\'ProviderDisplayName\' property cannot be set to \'\' for type \'ModelCodeFluent.Iden" +
                                                                                        "tity.UserLogin\'", null);
         CodeFluentPersistence.AddValidationError(results, localValidate3);
     }
     if ((this.User == null))
     {
         string localValidate4 = ModelCodeFluent.Resources.Manager.GetStringWithDefault(culture, "ModelCodeFluent.Identity.UserLogin.User.NullException", "\'User\' property cannot be set to \'\' for type \'ModelCodeFluent.Identity.UserLogin\'" +
                                                                                        "", null);
         CodeFluentPersistence.AddValidationError(results, localValidate4);
     }
     this.OnEntityAction(new CodeFluent.Runtime.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.Validated, false, results));
 }
Esempio n. 23
0
 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, "StockItem", "Save");
     persistence.AddParameter("@StockItem_Id", this.Id, ((int)(-1)));
     persistence.AddParameter("@StockItem_Publication_Id", this.PublicationId, ((int)(-1)));
     persistence.AddParameter("@StockItem_Space_Id", this.SpaceId, ((int)(-1)));
     persistence.AddParameter("@StockItem_Quantity", this.Quantity, CodeFluentPersistence.DefaultInt32Value);
     persistence.AddParameter("@StockItem_AvailableQuantity", this.AvailableQuantity, CodeFluentPersistence.DefaultInt32Value);
     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 void ReadRecord(System.Data.IDataReader reader, CodeFluent.Runtime.CodeFluentReloadOptions options)
 {
     if ((reader == null))
     {
         throw new System.ArgumentNullException("reader");
     }
     if ((((options & CodeFluent.Runtime.CodeFluentReloadOptions.Properties)
           == 0)
          == false))
     {
         this._fullName    = CodeFluentPersistence.GetReaderValue(reader, "Customer_FullName", ((string)(default(string))));
         this._dateOfBirth = CodeFluentPersistence.GetReaderValue(reader, "Customer_DateOfBirth", ((System.DateTime)(CodeFluentPersistence.DefaultDateTimeValue)));
     }
 }
Esempio n. 25
0
 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.SqlServerInMemory.Constants.SoftFluent_SqlServerInMemoryStoreName).Persistence;
     persistence.CreateStoredProcedureCommand(null, "Customer", "Save");
     persistence.AddParameter("@Customer_Id", this.Id, CodeFluentPersistence.DefaultGuidValue);
     persistence.AddParameter("@Customer_Name", this.Name, default(string));
     persistence.AddParameter("@Customer_ContactSource_Id", this.ContactSourceId, ((int)(-1)));
     persistence.AddParameter("@_trackLastWriteUser", persistence.Context.User.Name);
     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);
 }
Esempio n. 26
0
 protected virtual void ReadRecord(System.Data.IDataReader reader, CodeFluent.Runtime.CodeFluentReloadOptions options)
 {
     if ((reader == null))
     {
         throw new System.ArgumentNullException("reader");
     }
     if ((((options & CodeFluent.Runtime.CodeFluentReloadOptions.Properties)
           == 0)
          == false))
     {
         this._id             = CodeFluentPersistence.GetReaderValue(reader, "Customer_Id", ((System.Guid)(CodeFluentPersistence.DefaultGuidValue)));
         this._name           = CodeFluentPersistence.GetReaderValue(reader, "Customer_Name", ((string)(default(string))));
         this.ContactSourceId = CodeFluentPersistence.GetReaderValue(reader, "Customer_ContactSource_Id", ((int)(-1)));
     }
     this.OnEntityAction(new CodeFluent.Runtime.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.ReadRecord, false, false));
 }
 public virtual void ValidateLocal(System.Globalization.CultureInfo culture, System.Collections.Generic.IList <CodeFluent.Runtime.CodeFluentValidationException> results)
 {
     CodeFluent.Runtime.ServiceModel.CodeFluentEntityActionEventArgs evt = new CodeFluent.Runtime.ServiceModel.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.Validating, true, results);
     evt.Culture = culture;
     this.OnEntityAction(evt);
     if ((evt.Cancel == true))
     {
         string externalValidate;
         if ((evt.Argument != null))
         {
             externalValidate = evt.Argument.ToString();
         }
         else
         {
             externalValidate = ContactManager.Proxy.Resources.Manager.GetStringWithDefault(culture, "ContactManager.Proxy.ContactSource.ExternalValidate", "Type \'ContactManager.ContactSource\' cannot be validated.", null);
         }
         CodeFluentPersistence.AddValidationError(results, externalValidate);
     }
     CodeFluentPersistence.ValidateMember(culture, results, this, null);
     this.OnEntityAction(new CodeFluent.Runtime.ServiceModel.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.Validated, false, results));
 }
Esempio n. 28
0
 protected virtual void ReadRecord(System.Data.IDataReader reader, CodeFluent.Runtime.CodeFluentReloadOptions options)
 {
     if ((reader == null))
     {
         throw new System.ArgumentNullException("reader");
     }
     if ((((options & CodeFluent.Runtime.CodeFluentReloadOptions.Properties)
           == 0)
          == false))
     {
         this._id   = CodeFluentPersistence.GetReaderValue(reader, "Support_Id", ((int)(-1)));
         this._name = CodeFluentPersistence.GetReaderValue(reader, "Support_Name", ((string)(default(string))));
     }
     if ((((options & CodeFluent.Runtime.CodeFluentReloadOptions.RowVersion)
           == 0)
          == false))
     {
         this._rowVersion = CodeFluentPersistence.GetReaderValue(reader, "_rowVersion", ((byte[])(null)));
     }
     this.OnEntityAction(new CodeFluent.Runtime.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.ReadRecord, false, false));
 }
Esempio n. 29
0
 protected virtual void ReadRecord(System.Data.IDataReader reader, CodeFluent.Runtime.CodeFluentReloadOptions options)
 {
     if ((reader == null))
     {
         throw new System.ArgumentNullException("reader");
     }
     if ((((options & CodeFluent.Runtime.CodeFluentReloadOptions.Properties)
           == 0)
          == false))
     {
         this._vehicleId = CodeFluentPersistence.GetReaderValue(reader, "Vehicle_VehicleId", ((System.Guid)(CodeFluentPersistence.DefaultGuidValue)));
         this._brand     = CodeFluentPersistence.GetReaderValue(reader, "Vehicle_Brand", ((string)(default(string))));
     }
     if ((((options & CodeFluent.Runtime.CodeFluentReloadOptions.RowVersion)
           == 0)
          == false))
     {
         this._rowVersion = CodeFluentPersistence.GetReaderValue(reader, "_rowVersion", ((byte[])(null)));
     }
     this.OnEntityAction(new CodeFluent.Runtime.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.ReadRecord, false, false));
 }
Esempio n. 30
0
 public virtual void Validate(System.Globalization.CultureInfo culture, System.Collections.Generic.IList <CodeFluent.Runtime.CodeFluentValidationException> results)
 {
     CodeFluent.Runtime.CodeFluentEntityActionEventArgs evt = new CodeFluent.Runtime.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.Validating, true, results);
     evt.Culture = culture;
     this.OnEntityAction(evt);
     if ((evt.Cancel == true))
     {
         string externalValidate;
         if ((evt.Argument != null))
         {
             externalValidate = evt.Argument.ToString();
         }
         else
         {
             externalValidate = SoftFluent.Samples.Thinktecture.IdentityServer.Resources.Manager.GetStringWithDefault(culture, "SoftFluent.Samples.Thinktecture.IdentityServer.UserClaim.ExternalValidate", "Type \'SoftFluent.Samples.Thinktecture.IdentityServer.UserClaim\' cannot be validat" +
                                                                                                                      "ed.", null);
         }
         CodeFluentPersistence.AddValidationError(results, externalValidate);
     }
     CodeFluentPersistence.ValidateMember(culture, results, this, null);
     if ((this.Id.Equals(CodeFluentPersistence.DefaultGuidValue) == true))
     {
         string localValidate = SoftFluent.Samples.Thinktecture.IdentityServer.Resources.Manager.GetStringWithDefault(culture, "SoftFluent.Samples.Thinktecture.IdentityServer.UserClaim.Id.NullException", "\'Id\' property cannot be set to \'00000000-0000-0000-0000-000000000000\' for type \'S" +
                                                                                                                      "oftFluent.Samples.Thinktecture.IdentityServer.UserClaim\'", null);
         CodeFluentPersistence.AddValidationError(results, localValidate);
     }
     if ((this.Type == default(string)))
     {
         string localValidate1 = SoftFluent.Samples.Thinktecture.IdentityServer.Resources.Manager.GetStringWithDefault(culture, "SoftFluent.Samples.Thinktecture.IdentityServer.UserClaim.Type.NullException", "\'Type\' property cannot be set to \'\' for type \'SoftFluent.Samples.Thinktecture.Ide" +
                                                                                                                       "ntityServer.UserClaim\'", null);
         CodeFluentPersistence.AddValidationError(results, localValidate1);
     }
     if ((this.User == null))
     {
         string localValidate2 = SoftFluent.Samples.Thinktecture.IdentityServer.Resources.Manager.GetStringWithDefault(culture, "SoftFluent.Samples.Thinktecture.IdentityServer.UserClaim.User.NullException", "\'User\' property cannot be set to \'\' for type \'SoftFluent.Samples.Thinktecture.Ide" +
                                                                                                                       "ntityServer.UserClaim\'", null);
         CodeFluentPersistence.AddValidationError(results, localValidate2);
     }
     this.OnEntityAction(new CodeFluent.Runtime.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.Validated, false, results));
 }