/// <summary> /// 计算订单指定日期及状态的可用金额 /// </summary> /// <param name="dateFrom"></param> /// <param name="dateTo"></param> /// <param name="status"></param> /// <returns></returns> public static decimal GetMoney(int user_id, string dateFrom, string status) { decimal money = 0; string where = "Supplier_id = " + user_id + ""; if (dateFrom != "") { where = "datediff(d,Time_Add,'" + dateFrom + "')>=0"; } if (status != "") { if (dateFrom != "") { where += " and "; } where += status; } List <Lebi_Supplier_Money> models = B_Lebi_Supplier_Money.GetList(where, ""); foreach (Lebi_Supplier_Money model in models) { money = money + model.Money; } return(money); }
/// <summary> /// 更新商家资金 /// </summary> /// <param name="user"></param> public static void UpdateUserMoney(Lebi_Supplier user) { string money = B_Lebi_Supplier_Money.GetValue("sum(Money)", "Supplier_id=" + user.id + " and Type_id_MoneyStatus=181"); decimal Money = 0; Decimal.TryParse(money, out Money); user.Money = Money; B_Lebi_Supplier.Update(user); }