コード例 #1
0
        public static Common.Models.Events.EventAssignedContact Disable(Common.Models.Events.EventAssignedContact model,
                                                                        Common.Models.Account.Users disabler)
        {
            model.DisabledBy = disabler;
            model.Disabled   = DateTime.UtcNow;

            DataHelper.Disable <Common.Models.Events.EventAssignedContact,
                                DBOs.Events.EventAssignedContact>("event_assigned_contact", disabler.PId.Value, model.Id);

            return(model);
        }
コード例 #2
0
        public static Common.Models.Events.EventAssignedContact Disable(Common.Models.Events.EventAssignedContact model,
                                                                        Common.Models.Account.Users disabler,
                                                                        IDbConnection conn = null, bool closeConnection = true)
        {
            model.DisabledBy = disabler;
            model.Disabled   = DateTime.UtcNow;

            DataHelper.Disable <Common.Models.Events.EventAssignedContact,
                                DBOs.Events.EventAssignedContact>("event_assigned_contact", disabler.PId.Value, model.Id, conn, closeConnection);

            return(model);
        }
コード例 #3
0
        public static Common.Models.Events.EventAssignedContact Edit(Common.Models.Events.EventAssignedContact model,
                                                                     Common.Models.Account.Users modifier)
        {
            model.ModifiedBy = modifier;
            model.Modified   = DateTime.UtcNow;
            DBOs.Events.EventAssignedContact dbo = Mapper.Map <DBOs.Events.EventAssignedContact>(model);

            using (IDbConnection conn = Database.Instance.GetConnection())
            {
                conn.Execute("UPDATE \"event_assigned_contact\" SET " +
                             "\"event_id\"=@EventId, \"contact_id\"=@ContactId, \"role\"=@Role, \"utc_modified\"=@UtcModified, \"modified_by_user_pid\"=@ModifiedByUserPId " +
                             "WHERE \"id\"=@Id", dbo);
            }

            return(model);
        }
コード例 #4
0
        public static Common.Models.Events.EventAssignedContact Edit(Common.Models.Events.EventAssignedContact model,
                                                                     Common.Models.Account.Users modifier,
                                                                     IDbConnection conn = null, bool closeConnection = true)
        {
            model.ModifiedBy = modifier;
            model.Modified   = DateTime.UtcNow;
            DBOs.Events.EventAssignedContact dbo = Mapper.Map <DBOs.Events.EventAssignedContact>(model);

            conn = DataHelper.OpenIfNeeded(conn);

            conn.Execute("UPDATE \"event_assigned_contact\" SET " +
                         "\"event_id\"=@EventId, \"contact_id\"=@ContactId, \"role\"=@Role, \"utc_modified\"=@UtcModified, \"modified_by_user_pid\"=@ModifiedByUserPId " +
                         "WHERE \"id\"=@Id", dbo);

            DataHelper.Close(conn, closeConnection);

            return(model);
        }
コード例 #5
0
        public static Common.Models.Events.EventAssignedContact Create(Common.Models.Events.EventAssignedContact model,
                                                                       Common.Models.Account.Users creator)
        {
            if (!model.Id.HasValue)
            {
                model.Id = Guid.NewGuid();
            }
            model.Created   = model.Modified = DateTime.UtcNow;
            model.CreatedBy = model.ModifiedBy = creator;

            DBOs.Events.EventAssignedContact dbo = Mapper.Map <DBOs.Events.EventAssignedContact>(model);

            using (IDbConnection conn = Database.Instance.GetConnection())
            {
                conn.Execute("INSERT INTO \"event_assigned_contact\" (\"id\", \"event_id\", \"contact_id\", \"role\", \"utc_created\", \"utc_modified\", \"created_by_user_pid\", \"modified_by_user_pid\") " +
                             "VALUES (@Id, @EventId, @ContactId, @Role, @UtcCreated, @UtcModified, @CreatedByUserPId, @ModifiedByUserPId)",
                             dbo);
            }

            return(model);
        }
コード例 #6
0
        public static Common.Models.Events.EventAssignedContact Create(Common.Models.Events.EventAssignedContact model,
                                                                       Common.Models.Account.Users creator,
                                                                       IDbConnection conn = null, bool closeConnection = true)
        {
            if (!model.Id.HasValue)
            {
                model.Id = Guid.NewGuid();
            }
            model.Created   = model.Modified = DateTime.UtcNow;
            model.CreatedBy = model.ModifiedBy = creator;

            DBOs.Events.EventAssignedContact dbo = Mapper.Map <DBOs.Events.EventAssignedContact>(model);

            conn = DataHelper.OpenIfNeeded(conn);

            conn.Execute("INSERT INTO \"event_assigned_contact\" (\"id\", \"event_id\", \"contact_id\", \"role\", \"utc_created\", \"utc_modified\", \"created_by_user_pid\", \"modified_by_user_pid\") " +
                         "VALUES (@Id, @EventId, @ContactId, @Role, @UtcCreated, @UtcModified, @CreatedByUserPId, @ModifiedByUserPId)",
                         dbo);

            DataHelper.Close(conn, closeConnection);

            return(model);
        }