Пример #1
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;
        }
Пример #2
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;
        }
Пример #3
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);
        }
Пример #4
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);
        }