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

            using (IDbConnection conn = Database.Instance.GetConnection())
            {
                conn.Execute("UPDATE \"form_field\" SET " +
                             "\"title\"=@Title, \"description\"=@Description, \"utc_modified\"=@UtcModified, \"modified_by_user_pid\"=@ModifiedByUserPId " +
                             "WHERE \"id\"=@Id", dbo);
            }

            return(model);
        }
Ejemplo n.º 2
0
        public static Common.Models.Forms.FormField Create(Common.Models.Forms.FormField model,
                                                           Common.Models.Account.Users creator)
        {
            model.CreatedBy = model.ModifiedBy = creator;
            model.Created   = model.Modified = DateTime.UtcNow;
            DBOs.Forms.FormField dbo = Mapper.Map <DBOs.Forms.FormField>(model);

            using (IDbConnection conn = Database.Instance.GetConnection())
            {
                conn.Execute("INSERT INTO \"form_field\" (\"title\", \"description\", \"utc_created\", \"utc_modified\", \"created_by_user_pid\", \"modified_by_user_pid\") " +
                             "VALUES (@Title, @Description, @UtcCreated, @UtcModified, @CreatedByUserPId, @ModifiedByUserPId)",
                             dbo);
                model.Id = conn.Query <DBOs.Forms.FormField>("SELECT currval(pg_get_serial_sequence('form_field', 'id')) AS \"id\"").Single().Id;
            }

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

            conn = DataHelper.OpenIfNeeded(conn);

            conn.Execute("UPDATE \"form_field\" SET " +
                         "\"title\"=@Title, \"description\"=@Description, \"utc_modified\"=@UtcModified, \"modified_by_user_pid\"=@ModifiedByUserPId " +
                         "WHERE \"id\"=@Id", dbo);

            DataHelper.Close(conn, closeConnection);

            return(model);
        }
Ejemplo n.º 4
0
        public static Common.Models.Forms.FormField Create(
            Common.Models.Forms.FormField model,
            Common.Models.Account.Users creator,
            IDbConnection conn   = null,
            bool closeConnection = true)
        {
            model.CreatedBy = model.ModifiedBy = creator;
            model.Created   = model.Modified = DateTime.UtcNow;
            DBOs.Forms.FormField dbo = Mapper.Map <DBOs.Forms.FormField>(model);

            conn = DataHelper.OpenIfNeeded(conn);

            if (conn.Execute("INSERT INTO \"form_field\" (\"title\", \"description\", \"utc_created\", \"utc_modified\", \"created_by_user_pid\", \"modified_by_user_pid\") " +
                             "VALUES (@Title, @Description, @UtcCreated, @UtcModified, @CreatedByUserPId, @ModifiedByUserPId)",
                             dbo) > 0)
            {
                model.Id = conn.Query <DBOs.Forms.FormField>("SELECT currval(pg_get_serial_sequence('form_field', 'id')) AS \"id\"").Single().Id;
            }

            DataHelper.Close(conn, closeConnection);

            return(model);
        }