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

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

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

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

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

            conn = DataHelper.OpenIfNeeded(conn);

            conn.Execute("UPDATE \"matter_type\" SET " +
                         "\"title\"=@Title, \"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.Matters.MatterType Create(
            Common.Models.Matters.MatterType model,
            Common.Models.Account.Users creator,
            IDbConnection conn   = null,
            bool closeConnection = true)
        {
            model.CreatedBy = model.ModifiedBy = creator;
            model.Created   = model.Modified = DateTime.UtcNow;
            DBOs.Matters.MatterType dbo = Mapper.Map <DBOs.Matters.MatterType>(model);

            conn = DataHelper.OpenIfNeeded(conn);

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

            DataHelper.Close(conn, closeConnection);

            return(model);
        }