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

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

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

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

            return(model);
        }
Exemplo n.º 6
0
        public static Common.Models.Forms.Form Edit(Common.Models.Forms.Form model,
            Common.Models.Account.Users modifier)
        {
            model.ModifiedBy = modifier;
            model.Modified = DateTime.UtcNow;
            DBOs.Forms.Form dbo = Mapper.Map<DBOs.Forms.Form>(model);

            using (IDbConnection conn = Database.Instance.GetConnection())
            {
                conn.Execute("UPDATE \"form\" SET " +
                    "\"title\"=@Title, \"matter_type_id\"=@MatterTypeId, \"path\"=@Path, \"utc_modified\"=@UtcModified, \"modified_by_user_pid\"=@ModifiedByUserPId " +
                    "WHERE \"id\"=@Id", dbo);
            }

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

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

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

            conn = DataHelper.OpenIfNeeded(conn);

            conn.Execute("UPDATE \"form\" SET " +
                         "\"title\"=@Title, \"matter_type_id\"=@MatterTypeId, \"path\"=@Path, \"utc_modified\"=@UtcModified, \"modified_by_user_pid\"=@ModifiedByUserPId " +
                         "WHERE \"id\"=@Id", dbo);

            DataHelper.Close(conn, closeConnection);

            return(model);
        }
Exemplo n.º 9
0
        public static Common.Models.Forms.Form Create(
            Common.Models.Forms.Form 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.Form dbo = Mapper.Map <DBOs.Forms.Form>(model);

            conn = DataHelper.OpenIfNeeded(conn);

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

            DataHelper.Close(conn, closeConnection);

            return(model);
        }