Пример #1
0
        private WeixinPayLog convertToWeixinPayLog(DataRow dr)
        {
            var model = new WeixinPayLog();

            model.Id          = !Convert.IsDBNull(dr["Id"]) ? int.Parse(dr["Id"].ToString()) : 0;
            model.WxOpenId    = !Convert.IsDBNull(dr["WxOpenId"]) ? dr["WxOpenId"].ToString() : string.Empty;
            model.Status      = !Convert.IsDBNull(dr["Status"]) ? int.Parse(dr["Status"].ToString()) : 0;
            model.OrderId     = !Convert.IsDBNull(dr["OrderId"]) ? long.Parse(dr["OrderId"].ToString()) : 0;
            model.Amount      = !Convert.IsDBNull(dr["Amount"]) ?  decimal.Parse(dr["Amount"].ToString()) : 0;
            model.Description = !Convert.IsDBNull(dr["Description"]) ? dr["Description"].ToString() : string.Empty;
            model.CreateTime  = !Convert.IsDBNull(dr["CreateTime"]) ? Convert.ToDateTime(dr["CreateTime"]) : DateTime.MinValue;
            return(model);
        }
Пример #2
0
        public WeixinPayLog GetPayLogById(int id)
        {
            var paylog = new WeixinPayLog();

            using (var cmd = DataCommandManager.GetDataCommand("WexinPayLogGetById"))
            {
                cmd.SetParameterValue("@Id", id);
                using (var dr = cmd.ExecuteDataReader())
                {
                    while (dr.Read())
                    {
                        paylog = convertToWeixinPayLog(dr);
                    }
                }
            }
            return(paylog);
        }
Пример #3
0
 public int Insert(WeixinPayLog weixinPayLog)
 {
     using (var cmd = DataCommandManager.GetDataCommand("WeixinPayLogInsert"))
     {
         cmd.SetParameterValue("@OrderId", weixinPayLog.OrderId);
         cmd.SetParameterValue("@WxOpenId", weixinPayLog.WxOpenId);
         cmd.SetParameterValue("@Amount", weixinPayLog.Amount);
         cmd.SetParameterValue("@Description", weixinPayLog.Description);
         cmd.SetParameterValue("@Status", weixinPayLog.Status);
         cmd.SetParameterValue("@CreateTime", weixinPayLog.CreateTime);
         var result = cmd.ExecuteScalar();
         if (result != null)
         {
             return(Convert.ToInt32(result));
         }
         return(0);
     }
 }
Пример #4
0
 public int InsertWeixinPayLog(WeixinPayLog weixinPayLog)
 {
     return(payLogDataAccess.Insert(weixinPayLog));
 }