Esempio n. 1
0
        public static Common.Models.Events.Event Edit(Common.Models.Events.Event model,
                                                      Common.Models.Account.Users modifier)
        {
            model.ModifiedBy = modifier;
            model.Modified   = DateTime.UtcNow;
            DBOs.Events.Event dbo = Mapper.Map <DBOs.Events.Event>(model);

            using (IDbConnection conn = Database.Instance.GetConnection())
            {
                conn.Execute("UPDATE \"event\" SET " +
                             "\"title\"=@Title, \"allday\"=@AllDay, \"start\"=@Start, " +
                             "\"end\"=@End, \"location\"=@Location, \"description\"=@Description, " +
                             "\"utc_modified\"=@UtcModified, \"modified_by_user_pid\"=@ModifiedByUserPId " +
                             "WHERE \"id\"=@Id", dbo);
            }

            return(model);
        }
Esempio n. 2
0
        public static Common.Models.Events.Event Edit(Common.Models.Events.Event model,
                                                      Common.Models.Account.Users modifier,
                                                      IDbConnection conn = null, bool closeConnection = true)
        {
            model.ModifiedBy = modifier;
            model.Modified   = DateTime.UtcNow;
            DBOs.Events.Event dbo = Mapper.Map <DBOs.Events.Event>(model);

            conn = DataHelper.OpenIfNeeded(conn);

            conn.Execute("UPDATE \"event\" SET " +
                         "\"title\"=@Title, \"allday\"=@AllDay, \"start\"=@Start, " +
                         "\"end\"=@End, \"location\"=@Location, \"description\"=@Description, " +
                         "\"utc_modified\"=@UtcModified, \"modified_by_user_pid\"=@ModifiedByUserPId " +
                         "WHERE \"id\"=@Id", dbo);

            DataHelper.Close(conn, closeConnection);

            return(model);
        }
Esempio n. 3
0
        public static Common.Models.Events.Event Create(Common.Models.Events.Event model,
                                                        Common.Models.Account.Users creator)
        {
            if (!model.Id.HasValue)
            {
                model.Id = Guid.NewGuid();
            }
            model.CreatedBy = model.ModifiedBy = creator;
            model.Created   = model.Modified = DateTime.UtcNow;
            DBOs.Events.Event dbo = null;

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

            using (IDbConnection conn = Database.Instance.GetConnection())
            {
                conn.Execute("INSERT INTO \"event\" (\"id\", \"title\", \"allday\", \"start\", \"end\", \"location\", \"description\", \"utc_created\", \"utc_modified\", \"created_by_user_pid\", \"modified_by_user_pid\") " +
                             "VALUES (@Id, @Title, @AllDay, @Start, @End, @Location, @Description, @UtcCreated, @UtcModified, @CreatedByUserPId, @ModifiedByUserPId)",
                             dbo);
            }

            return(model);
        }
Esempio n. 4
0
        public static Common.Models.Events.Event Create(Common.Models.Events.Event model,
                                                        Common.Models.Account.Users creator,
                                                        IDbConnection conn = null, bool closeConnection = true)
        {
            if (!model.Id.HasValue)
            {
                model.Id = Guid.NewGuid();
            }
            model.CreatedBy = model.ModifiedBy = creator;
            model.Created   = model.Modified = DateTime.UtcNow;
            DBOs.Events.Event dbo = null;

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

            conn = DataHelper.OpenIfNeeded(conn);

            conn.Execute("INSERT INTO \"event\" (\"id\", \"title\", \"allday\", \"start\", \"end\", \"location\", \"description\", \"utc_created\", \"utc_modified\", \"created_by_user_pid\", \"modified_by_user_pid\") " +
                         "VALUES (@Id, @Title, @AllDay, @Start, @End, @Location, @Description, @UtcCreated, @UtcModified, @CreatedByUserPId, @ModifiedByUserPId)",
                         dbo);

            DataHelper.Close(conn, closeConnection);

            return(model);
        }