Ejemplo n.º 1
0
 public static Common.Models.Forms.FormField Create(
     Transaction t,
     Common.Models.Forms.FormField model,
     Common.Models.Account.Users creator)
 {
     return(Create(model, creator, t.Connection, false));
 }
Ejemplo n.º 2
0
 public static Common.Models.Forms.FormField Disable(
     Transaction t,
     Common.Models.Forms.FormField model,
     Common.Models.Account.Users disabler)
 {
     return(Disable(model, disabler, t.Connection, false));
 }
Ejemplo n.º 3
0
 public static Common.Models.Forms.FormField Edit(
     Transaction t,
     Common.Models.Forms.FormField model,
     Common.Models.Account.Users modifier)
 {
     return(Edit(model, modifier, t.Connection, false));
 }
Ejemplo n.º 4
0
        public static Common.Models.Forms.FormField Disable(Common.Models.Forms.FormField model,
                                                            Common.Models.Account.Users disabler)
        {
            model.DisabledBy = disabler;
            model.Disabled   = DateTime.UtcNow;

            DataHelper.Disable <Common.Models.Forms.FormField,
                                DBOs.Forms.FormField>("form_field", disabler.PId.Value, model.Id);

            return(model);
        }
Ejemplo n.º 5
0
        public static Common.Models.Forms.FormField Disable(
            Common.Models.Forms.FormField model,
            Common.Models.Account.Users disabler,
            IDbConnection conn   = null,
            bool closeConnection = true)
        {
            model.DisabledBy = disabler;
            model.Disabled   = DateTime.UtcNow;

            DataHelper.Disable <Common.Models.Forms.FormField,
                                DBOs.Forms.FormField>("form_field", disabler.PId.Value, model.Id, conn, closeConnection);

            return(model);
        }
Ejemplo n.º 6
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.º 7
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.º 8
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.º 9
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);
        }