public bool Insert(D_CustomerRechargeEntity model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into D_CustomerRecharge("); strSql.Append("Message,create_time,create_user,update_time,update_user,delete_flag,delete_time,delete_user,RechargeId,RechargeType,[From],TradeNo,CustomerId,CustomerName,Amount,Status,ResponseTime,OrderId,SubRechargeType"); strSql.Append(") values ("); strSql.Append("@Message,GETDATE(),@create_user,NULL,NULL,NULL,NULL,NULL,@RechargeId,@RechargeType,@From,@TradeNo,@CustomerId,@CustomerName,@Amount,@Status,NULL,@OrderId,@SubRechargeType"); strSql.Append(") "); adjDbObject.GetSqlStringCommand(strSql.ToString()); adjDbObject.AddInParameter("@Message", DbType.String, model.Message); adjDbObject.AddInParameter("@create_user", DbType.String, model.create_user); adjDbObject.AddInParameter("@RechargeId", DbType.String, model.RechargeId); adjDbObject.AddInParameter("@CustomerName", DbType.String, model.CustomerName); adjDbObject.AddInParameter("@RechargeType", DbType.String, model.RechargeType); adjDbObject.AddInParameter("@From", DbType.Int32, model.From); adjDbObject.AddInParameter("@TradeNo", DbType.String, model.TradeNo); adjDbObject.AddInParameter("@CustomerId", DbType.String, model.CustomerId); adjDbObject.AddInParameter("@Amount", DbType.Decimal, model.Amount); adjDbObject.AddInParameter("@Status", DbType.Int32, model.Status); if (!string.IsNullOrEmpty(model.OrderId)) { adjDbObject.AddInParameter("@OrderId", DbType.String, model.OrderId); } else { adjDbObject.AddInParameter("@OrderId", DbType.String, DBNull.Value); } if (model.SubRechargeType != null) { adjDbObject.AddInParameter("@SubRechargeType", DbType.String, model.SubRechargeType); } else { adjDbObject.AddInParameter("@SubRechargeType", DbType.String, DBNull.Value); } return adjDbObject.Execute() > 0; }
public string execute(string request) { //1220|1|6|U0089023|某某|38.00|MV2JL366U9H1|1|3fe5d0205970e8a732686c7cc2e99999|5874bddc503680232ffab25fbd9f4b6e string[] req = request.Split('|'); var sign = EncodingUtil.GetMd5(req[6] + "aidaijia", "utf-8"); if (sign.ToLower() == req[9].ToLower()) { T_ParterEntity parter = new T_PartyDal().GetParterModelBySign(req[8].ToLower()); if (parter != null) { D_CustomerRechargeEntity dcre = new D_CustomerRechargeEntity(); CustomerInfoEntity ci = new D_CustomerInfoDal().GetClientInfoByPhone(req[3]); string cn = string.IsNullOrEmpty(ci.CustomerId) ? string.Empty : ci.CustomerId; dcre.RechargeType =Convert.ToInt32(req[1]); dcre.From = Convert.ToInt32(req[2]); dcre.CustomerName = req[4]; dcre.CustomerId = cn; dcre.Amount = Convert.ToDecimal(req[5]); dcre.Status = 0; dcre.create_user = "******"; dcre.OrderId = req[6]; dcre.SubRechargeType = Convert.ToInt32(req[7]); string RechargeId = AddCustomerRecharge(dcre); return JsonHelper.ToJson<object>(new { out_trade_no = RechargeId }); } else { throw new Exception("商户标识错误"); } } else { throw new Exception("签名错误。"); } }
private string AddCustomerRecharge(D_CustomerRechargeEntity CostomerEn) { int seq = dcr.SelectSeq(); string ICId = string.Empty; if (!string.IsNullOrEmpty(CostomerEn.OrderId)) { ICId = CustomerRechargeIdByThirdParty(seq); } D_CustomerRechargeEntity entity = new D_CustomerRechargeEntity() { RechargeId = ICId, RechargeType = CostomerEn.RechargeType, From = CostomerEn.From, CustomerId = CostomerEn.CustomerId, Amount = CostomerEn.Amount, create_user = CostomerEn.create_user, Status = CostomerEn.Status, CustomerName = CostomerEn.CustomerName, OrderId = CostomerEn.OrderId, SubRechargeType = CostomerEn.SubRechargeType }; dcr.Insert(entity); return ICId; }