Exemple #1
0
        public virtual LightboxSent Update(LightboxSent lightboxSent)
        {
            if (!lightboxSent.IsDirty || lightboxSent.IsNull)
            {
                // Nothing to do - no point hammering the database unnecessarily
                return(lightboxSent);
            }

            IDbCommand command = CreateCommand();

            if (lightboxSent.IsNew)
            {
                // Adding
                command.CommandText = "INSERT INTO [LightboxSent] ([LightboxId], [CreatedLightboxId], [SenderId], [RecipientEmail], [Subject], [Message], [DateSent], [ExpiryDate], [DownloadLinks], [LightboxLinkedId]) VALUES (@lightboxId, @createdLightboxId, @senderId, @recipientEmail, @subject, @message, @dateSent, @expiryDate, @downloadLinks, @lightboxLinkedId) ; SELECT @@identity AS NewId;";
            }
            else
            {
                // Updating
                command.CommandText = "UPDATE [LightboxSent] SET [LightboxId] = @lightboxId, [CreatedLightboxId] = @createdLightboxId, [SenderId] = @senderId, [RecipientEmail] = @recipientEmail, [Subject] = @subject, [Message] = @message, [DateSent] = @dateSent, [ExpiryDate] = @expiryDate, [DownloadLinks] = @downloadLinks, [LightboxLinkedId] = @lightboxLinkedId WHERE LightboxSentId = @lightboxSentId";
            }

            command.Parameters.Add(CreateParameter("@lightboxId", lightboxSent.LightboxId));
            command.Parameters.Add(CreateParameter("@createdLightboxId", lightboxSent.CreatedLightboxId));
            command.Parameters.Add(CreateParameter("@senderId", lightboxSent.SenderId));
            command.Parameters.Add(CreateParameter("@recipientEmail", lightboxSent.RecipientEmail));
            command.Parameters.Add(CreateParameter("@subject", lightboxSent.Subject));
            command.Parameters.Add(CreateParameter("@message", lightboxSent.Message));
            command.Parameters.Add(CreateParameter("@dateSent", lightboxSent.DateSent));
            command.Parameters.Add(CreateParameter("@expiryDate", lightboxSent.ExpiryDate));
            command.Parameters.Add(CreateParameter("@downloadLinks", lightboxSent.DownloadLinks));
            command.Parameters.Add(CreateParameter("@lightboxLinkedId", lightboxSent.LightboxLinkedId));

            if (lightboxSent.IsNew)
            {
                lightboxSent.LightboxSentId = Convert.ToInt32(ExecScalar(command));
            }
            else
            {
                command.Parameters.Add(CreateParameter("@lightboxSentId", lightboxSent.LightboxSentId));
                ExecuteCommand(command);
            }

            lightboxSent.IsDirty = false;
            lightboxSent.ChangedProperties.Clear();

            return(lightboxSent);
        }
Exemple #2
0
        protected override object ReadRow(IRowReader reader)
        {
            LightboxSent lightboxSent = LightboxSent.New();

            // Table Fields
            lightboxSent.LightboxSentId    = reader.GetInt32("LightboxSentId");
            lightboxSent.LightboxId        = reader.GetInt32("LightboxId");
            lightboxSent.CreatedLightboxId = reader.GetNullableInt32("CreatedLightboxId");
            lightboxSent.SenderId          = reader.GetInt32("SenderId");
            lightboxSent.RecipientEmail    = reader.GetString("RecipientEmail");
            lightboxSent.Subject           = reader.GetString("Subject");
            lightboxSent.Message           = reader.GetString("Message");
            lightboxSent.DateSent          = reader.GetDateTime("DateSent");
            lightboxSent.ExpiryDate        = reader.GetNullableDateTime("ExpiryDate");
            lightboxSent.DownloadLinks     = reader.GetNullableBoolean("DownloadLinks");
            lightboxSent.LightboxLinkedId  = reader.GetNullableInt32("LightboxLinkedId");


            lightboxSent.IsDirty = false;
            lightboxSent.ChangedProperties.Clear();

            return(lightboxSent);
        }
Exemple #3
0
        public static LightboxSent FindOne(LightboxSentFinder finder)
        {
            LightboxSent LightboxSent = LightboxSentMapper.Instance.FindOne(finder);

            return(LightboxSent ?? Empty);
        }
Exemple #4
0
 public static LightboxSent Update(LightboxSent lightboxSent)
 {
     return(LightboxSentMapper.Instance.Update(lightboxSent));
 }
Exemple #5
0
        public static LightboxSent Get(Nullable <Int32> LightboxSentId)
        {
            LightboxSent LightboxSent = LightboxSentMapper.Instance.Get(LightboxSentId);

            return(LightboxSent ?? Empty);
        }