示例#1
0
 /// <summary>
 /// 创建积分订单记录
 /// </summary>
 /// <param name="uId">用户uid</param>
 /// <param name="buyer">用户登录名</param>
 /// <param name="credit">操作积分类型(扩展积分1-8)</param>
 /// <param name="amount">操作积分数量</param>
 /// <param name="paytype">支付种类(支付宝或其他)</param>
 /// <param name="outTradeNo">外部订单号(支付宝要求的形如:20080104140009iwGampfQkzFgMZ0yoT)</param>
 /// <returns></returns>
 public static int CreateCreditOrder(int uId, string buyer, int credit, int amount, int paytype, string outTradeNo)
 {
     if (uId < 0 || string.IsNullOrEmpty(buyer) || credit < 1 || credit > 8 || amount < 1 || string.IsNullOrEmpty(outTradeNo))
         return 0;
     CreditOrderInfo order = new CreditOrderInfo();
     order.Uid = uId;
     order.OrderCode = outTradeNo;
     order.Amount = amount;
     order.Credit = credit;
     order.Buyer = buyer;
     order.OrderStatus = 0;
     order.PayType = paytype;
     order.Price = decimal.Round(((decimal)amount / (decimal)GeneralConfigs.GetConfig().Cashtocreditrate), 2);
     return Data.CreditOrders.CreateCreditOrder(order);
 }
示例#2
0
 private static CreditOrderInfo LoadCreditOrderInfo(IDataReader reader)
 {
     CreditOrderInfo orderInfo = new CreditOrderInfo();
     orderInfo.Amount = TypeConverter.ObjectToInt(reader["amount"]);
     orderInfo.Buyer = reader["buyer"].ToString();
     orderInfo.CreatedTime = reader["createdtime"].ToString();
     orderInfo.ConfirmedTime=reader["confirmedtime"].ToString();
     orderInfo.Credit = TypeConverter.ObjectToInt(reader["credit"]);
     orderInfo.OrderCode = reader["ordercode"].ToString();
     orderInfo.OrderId = TypeConverter.ObjectToInt(reader["orderid"]);
     orderInfo.OrderStatus = TypeConverter.ObjectToInt(reader["orderstatus"]);
     orderInfo.PayType = TypeConverter.ObjectToInt(reader["paytype"]);
     orderInfo.Price = (decimal)TypeConverter.ObjectToFloat(reader["price"]);
     orderInfo.TradeNo = reader["tradeno"].ToString();
     orderInfo.Uid = TypeConverter.ObjectToInt(reader["uid"]);
     return orderInfo;
 }
示例#3
0
 /// <summary>
 /// 创建积分订单信息
 /// </summary>
 /// <param name="creditOrderInfo"></param>
 /// <returns></returns>
 public int CreateCreditOrder(CreditOrderInfo creditOrderInfo)
 {
     DbParameter[] parms = {
                               DbHelper.MakeInParam("@ordercode",(DbType)SqlDbType.Char, 32, creditOrderInfo.OrderCode),
                               DbHelper.MakeInParam("@uid",(DbType)SqlDbType.Int,4,creditOrderInfo.Uid),
                               DbHelper.MakeInParam("@buyer",(DbType)SqlDbType.Char,20,creditOrderInfo.Buyer),
                               DbHelper.MakeInParam("@paytype",(DbType)SqlDbType.TinyInt,2,creditOrderInfo.PayType),
                               DbHelper.MakeInParam("@price",(DbType)SqlDbType.Float,8,creditOrderInfo.Price),
                               DbHelper.MakeInParam("@orderstatus",(DbType)SqlDbType.TinyInt,2,creditOrderInfo.OrderStatus),
                               DbHelper.MakeInParam("@credit",(DbType)SqlDbType.TinyInt,2,creditOrderInfo.Credit),
                               DbHelper.MakeInParam("@amount",(DbType)SqlDbType.Int,4,creditOrderInfo.Amount)
                           };
     return DbHelper.ExecuteNonQuery(CommandType.StoredProcedure, string.Format("[{0}createorder]", BaseConfigs.GetTablePrefix), parms);
 }
示例#4
0
 /// <summary>
 /// 通过ordercode获取积分订单信息
 /// </summary>
 /// <param name="orderCode">订单外部订单号</param>
 /// <returns></returns>
 public static CreditOrderInfo GetCreditOrderByOrderCode(string orderCode)
 {
     IDataReader reader = DatabaseProvider.GetInstance().GetCreditOrderByOrderCode(orderCode);
     CreditOrderInfo orderInfo = new CreditOrderInfo();
     if (reader.Read())
     {
         orderInfo = LoadCreditOrderInfo(reader);
     }
     reader.Close();
     return orderInfo;
 }
示例#5
0
 /// <summary>
 /// 创建积分订单信息
 /// </summary>
 /// <param name="creditOrderInfo"></param>
 /// <returns></returns>
 public static int CreateCreditOrder(CreditOrderInfo creditOrderInfo)
 {
     return DatabaseProvider.GetInstance().CreateCreditOrder(creditOrderInfo);
 }