예제 #1
0
        public static Common.Models.Billing.Expense Edit(Common.Models.Billing.Expense model,
                                                         Common.Models.Account.Users modifier)
        {
            model.ModifiedBy = modifier;
            model.Modified   = DateTime.UtcNow;
            DBOs.Billing.Expense dbo = Mapper.Map <DBOs.Billing.Expense>(model);

            using (IDbConnection conn = Database.Instance.GetConnection())
            {
                conn.Execute("UPDATE \"expense\" SET " +
                             "\"incurred\"=@Incurred, \"paid\"=@Paid, \"vendor\"=@Vendor, \"amount\"=@Amount, \"details\"=@Details, " +
                             "\"utc_modified\"=@UtcModified, \"modified_by_user_pid\"=@ModifiedByUserPId " +
                             "WHERE \"id\"=@Id", dbo);
            }

            return(model);
        }
예제 #2
0
        public static Common.Models.Billing.Expense Create(Common.Models.Billing.Expense model, Common.Models.Account.Users creator)
        {
            if (!model.Id.HasValue)
            {
                model.Id = Guid.NewGuid();
            }
            model.CreatedBy = model.ModifiedBy = creator;
            model.Created   = model.Modified = DateTime.UtcNow;
            DBOs.Billing.Expense dbo = Mapper.Map <DBOs.Billing.Expense>(model);

            using (IDbConnection conn = Database.Instance.GetConnection())
            {
                conn.Execute("INSERT INTO \"expense\" (\"id\", \"incurred\", \"paid\", \"vendor\", \"amount\", \"details\", \"utc_created\", \"utc_modified\", \"created_by_user_pid\", \"modified_by_user_pid\") " +
                             "VALUES (@Id, @Incurred, @Paid, @Vendor, @Amount, @Details, @UtcCreated, @UtcModified, @CreatedByUserPId, @ModifiedByUserPId)",
                             dbo);
            }

            return(model);
        }
예제 #3
0
        public static Common.Models.Billing.Expense Edit(
            Common.Models.Billing.Expense model,
            Common.Models.Account.Users modifier,
            IDbConnection conn   = null,
            bool closeConnection = true)
        {
            model.ModifiedBy = modifier;
            model.Modified   = DateTime.UtcNow;
            DBOs.Billing.Expense dbo = Mapper.Map <DBOs.Billing.Expense>(model);

            conn = DataHelper.OpenIfNeeded(conn);

            conn.Execute("UPDATE \"expense\" SET " +
                         "\"incurred\"=@Incurred, \"paid\"=@Paid, \"vendor\"=@Vendor, \"amount\"=@Amount, \"details\"=@Details, " +
                         "\"utc_modified\"=@UtcModified, \"modified_by_user_pid\"=@ModifiedByUserPId " +
                         "WHERE \"id\"=@Id", dbo);

            DataHelper.Close(conn, closeConnection);

            return(model);
        }
예제 #4
0
        public static Common.Models.Billing.Expense Create(
            Common.Models.Billing.Expense model,
            Common.Models.Account.Users creator,
            IDbConnection conn   = null,
            bool closeConnection = true)
        {
            if (!model.Id.HasValue)
            {
                model.Id = Guid.NewGuid();
            }
            model.CreatedBy = model.ModifiedBy = creator;
            model.Created   = model.Modified = DateTime.UtcNow;
            DBOs.Billing.Expense dbo = Mapper.Map <DBOs.Billing.Expense>(model);

            conn = DataHelper.OpenIfNeeded(conn);

            conn.Execute("INSERT INTO \"expense\" (\"id\", \"incurred\", \"paid\", \"vendor\", \"amount\", \"details\", \"utc_created\", \"utc_modified\", \"created_by_user_pid\", \"modified_by_user_pid\") " +
                         "VALUES (@Id, @Incurred, @Paid, @Vendor, @Amount, @Details, @UtcCreated, @UtcModified, @CreatedByUserPId, @ModifiedByUserPId)",
                         dbo);

            DataHelper.Close(conn, closeConnection);

            return(model);
        }