protected void Page_Load(object sender, EventArgs e) { WxPayData notifyData = new Notify(this.Page).GetNotifyData(); if (!notifyData.IsSet("transaction_id")) { WxPayData res = new WxPayData(); res.SetValue("return_code", "FAIL"); res.SetValue("return_msg", "支付结果中微信订单号不存在"); Log.Error(base.GetType().ToString(), "The Pay result is error : " + res.ToXml()); this.Page.Response.Write(res.ToXml()); this.Page.Response.End(); } string transaction_id = notifyData.GetValue("transaction_id").ToString(); string out_trade_no = notifyData.GetValue("out_trade_no").ToString(); if (!this.QueryOrder(transaction_id)) { WxPayData res = new WxPayData(); res.SetValue("return_code", "FAIL"); res.SetValue("return_msg", "订单查询失败"); Log.Error(base.GetType().ToString(), "Order query failure : " + res.ToXml()); this.Page.Response.Write(res.ToXml()); this.Page.Response.End(); } else { string attach = notifyData.GetValue("attach").ToString(); string[] data = attach.Split(new char[] { ',' }); Chain.BLL.PointLog bllPoint = new Chain.BLL.PointLog(); int intUserID = 1; int intUserShopID = 1; int intMemID = int.Parse(data[0]); decimal money = decimal.Parse(data[1]); decimal giveMoney = decimal.Parse(data[2]); string rechargeAccount = data[3]; int point = int.Parse(data[4]); int count = new Chain.BLL.MemRecharge().GetRecordCount("RechargeAccount='" + rechargeAccount + "'"); if (count <= 0) { if (money + giveMoney <= 0m) { this.Context.Response.Write("-6"); } else { string strRemark = "无"; DateTime createTime = DateTime.Now; Chain.BLL.Mem bllMem = new Chain.BLL.Mem(); Chain.Model.Mem modelMem = bllMem.GetModel(intMemID); Chain.BLL.PointLog bllPoingLog = new Chain.BLL.PointLog(); Chain.Model.PointLog mdPoint = new Chain.Model.PointLog(); string Remark = string.Concat(new object[] { "会员微信充值,充值金额:[", money.ToString(), "],赠送:[", giveMoney, "],备注:", strRemark }); decimal sumMoney = money + giveMoney; Chain.Model.MemRecharge mdRechange = new Chain.Model.MemRecharge(); mdRechange.RechargeMemID = intMemID; mdRechange.RechargeAccount = rechargeAccount; mdRechange.RechargeMoney = money + giveMoney; mdRechange.RechargeShopID = intUserShopID; mdRechange.RechargeUserID = intUserID; mdRechange.RechargeCreateTime = createTime; mdRechange.RechargeIsApprove = true; mdRechange.RechargeRemark = strRemark; mdRechange.RechargePoint = point; mdRechange.RechargeType = 6; mdRechange.RechargeGive = giveMoney; mdRechange.RechargeCardBalance = modelMem.MemMoney + sumMoney; int flag = new Chain.BLL.MemRecharge().Add(mdRechange); modelMem.MemMoney += sumMoney; modelMem.MemPoint += point; bllMem.Update(modelMem); Chain.Model.MoneyChangeLog moneyChangeLogModel = new Chain.Model.MoneyChangeLog(); moneyChangeLogModel.MoneyChangeMemID = modelMem.MemID; moneyChangeLogModel.MoneyChangeUserID = intUserID; moneyChangeLogModel.MoneyChangeType = 1; moneyChangeLogModel.MoneyChangeAccount = rechargeAccount; moneyChangeLogModel.MoneyChangeMoney = sumMoney; moneyChangeLogModel.MemMoney = modelMem.MemMoney; moneyChangeLogModel.MoneyChangeCreateTime = DateTime.Now; moneyChangeLogModel.MoneyChangeGiveMoney = giveMoney; new Chain.BLL.MoneyChangeLog().Add(moneyChangeLogModel); mdPoint.PointMemID = modelMem.MemID; mdPoint.PointNumber = point; mdPoint.PointChangeType = 15; mdPoint.PointRemark = string.Concat(new object[] { "会员充值,充值金额:[", money, "],获得积分:[", point, "]" }); mdPoint.PointShopID = intUserShopID; mdPoint.PointCreateTime = DateTime.Now; mdPoint.PointUserID = intUserID; mdPoint.PointOrderCode = rechargeAccount; bllPoint.Add(mdPoint); if (PubFunction.curParameter.bolShopPointManage) { PubFunction.SetShopPoint(intUserID, intUserShopID, point, "会员充值扣除店铺积分", 2); } MEMPointUpdate.MEMPointRate(modelMem, point, rechargeAccount, 15, intUserID, intUserShopID); modelMem = new Chain.BLL.Mem().GetModel(modelMem.MemID); PubFunction.UpdateMemLevel(modelMem); WxPayData res = new WxPayData(); res.SetValue("return_code", "SUCCESS"); res.SetValue("return_msg", "OK"); Log.Info(base.GetType().ToString(), "order query success : " + res.ToXml()); this.Page.Response.Write(res.ToXml()); this.Page.Response.End(); } } } }
protected void btnMemImport_Click(object sender, EventArgs e) { lock (DataExcelIn._syncObj) { this.strSavePath = this.strPath.Value; if (File.Exists(this.strSavePath)) { if (this.bolMainIndex) { string errstr = ""; DataTable dtMem = DataExcelInfo.CheckMemDataExcel(this.strSavePath, ref errstr); if (!string.IsNullOrEmpty(errstr)) { File.Delete(this.strSavePath); base.OutputWarn(errstr); } else if (DataExcelInfo.MemImport(dtMem, this.curParameter.bolPwd, this._UserID)) { base.OutputWarn("恭喜您,导入会员成功!"); Chain.BLL.Mem memBll = new Chain.BLL.Mem(); Chain.Model.Mem memModel = new Chain.Model.Mem(); for (int rowIndex = 0; rowIndex < dtMem.Rows.Count; rowIndex++) { decimal memMoney = Convert.ToDecimal(dtMem.Rows[rowIndex]["MemMoney"]); if (memMoney != 0m) { memModel = memBll.GetModelByMemCard(dtMem.Rows[rowIndex]["MemCard"].ToString()); Chain.Model.MoneyChangeLog moneyChangeLogModel = new Chain.Model.MoneyChangeLog(); moneyChangeLogModel.MoneyChangeMemID = memModel.MemID; moneyChangeLogModel.MoneyChangeUserID = this._UserID; moneyChangeLogModel.MoneyChangeType = 6; moneyChangeLogModel.MoneyChangeAccount = ""; moneyChangeLogModel.MoneyChangeMoney = memModel.MemMoney; moneyChangeLogModel.MemMoney = memModel.MemMoney; moneyChangeLogModel.MoneyChangeCreateTime = DateTime.Now; moneyChangeLogModel.MoneyChangeGiveMoney = memModel.MemMoney; new Chain.BLL.MoneyChangeLog().Add(moneyChangeLogModel); Chain.Model.MemRecharge modelRecharge = new Chain.Model.MemRecharge(); modelRecharge.RechargeMemID = memModel.MemID; modelRecharge.RechargeType = 1; modelRecharge.RechargeMoney = 0m; modelRecharge.RechargeGive = memModel.MemMoney; modelRecharge.RechargeRemark = "会员登记赠送金额,初始金额:" + memModel.MemMoney.ToString(); modelRecharge.RechargeShopID = this._UserShopID; modelRecharge.RechargeCreateTime = DateTime.Now; modelRecharge.RechargeAccount = PubFunction.curParameter.strMemRechargePrefix + DateTime.Now.ToString("yyMMddHHmmssffff"); modelRecharge.RechargeUserID = this._UserID; modelRecharge.RechargeCardBalance = memModel.MemMoney; modelRecharge.RechargeIsApprove = true; Chain.BLL.MemRecharge bllRecharge = new Chain.BLL.MemRecharge(); bllRecharge.Add(modelRecharge); } } this.strSavePath = ""; this.bolMainIndex = false; } else { File.Delete(this.strSavePath); base.OutputWarn("导入会员失败,请再次检验并改正会员数据!"); } } else { File.Delete(this.strSavePath); base.OutputWarn("您导入的会员数据还没有检验成功,请通过检验再导入会员数据。"); } } else { base.OutputWarn("您还没有检验会员数据,请先检验数据"); } } }
public bool Update(Chain.Model.MemRecharge model) { return(this.dal.Update(model)); }
public List <Chain.Model.MemRecharge> DataTableToList(DataTable dt) { List <Chain.Model.MemRecharge> modelList = new List <Chain.Model.MemRecharge>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { for (int i = 0; i < rowsCount; i++) { Chain.Model.MemRecharge model = new Chain.Model.MemRecharge(); if (dt.Rows[i]["RechargeID"] != null && dt.Rows[i]["RechargeID"].ToString() != "") { model.RechargeID = int.Parse(dt.Rows[i]["RechargeID"].ToString()); } if (dt.Rows[i]["RechargeMemID"] != null && dt.Rows[i]["RechargeMemID"].ToString() != "") { model.RechargeMemID = int.Parse(dt.Rows[i]["RechargeMemID"].ToString()); } if (dt.Rows[i]["RechargeAccount"] != null && dt.Rows[i]["RechargeAccount"].ToString() != "") { model.RechargeAccount = dt.Rows[i]["RechargeAccount"].ToString(); } if (dt.Rows[i]["RechargeType"] != null && dt.Rows[i]["RechargeType"].ToString() != "") { model.RechargeType = int.Parse(dt.Rows[i]["RechargeType"].ToString()); } if (dt.Rows[i]["RechargeMoney"] != null && dt.Rows[i]["RechargeMoney"].ToString() != "") { model.RechargeMoney = decimal.Parse(dt.Rows[i]["RechargeMoney"].ToString()); } if (dt.Rows[i]["RechargeRemark"] != null && dt.Rows[i]["RechargeRemark"].ToString() != "") { model.RechargeRemark = dt.Rows[i]["RechargeRemark"].ToString(); } if (dt.Rows[i]["RechargeShopID"] != null && dt.Rows[i]["RechargeShopID"].ToString() != "") { model.RechargeShopID = int.Parse(dt.Rows[i]["RechargeShopID"].ToString()); } if (dt.Rows[i]["RechargeCreateTime"] != null && dt.Rows[i]["RechargeCreateTime"].ToString() != "") { model.RechargeCreateTime = DateTime.Parse(dt.Rows[i]["RechargeCreateTime"].ToString()); } if (dt.Rows[i]["RechargeUserID"] != null && dt.Rows[i]["RechargeUserID"].ToString() != "") { model.RechargeUserID = int.Parse(dt.Rows[i]["RechargeUserID"].ToString()); } if (dt.Rows[i]["RechargeCardBalance"] != null && dt.Rows[i]["RechargeCardBalance"].ToString() != "") { model.RechargeCardBalance = decimal.Parse(dt.Rows[i]["RechargeCardBalance"].ToString()); } if (dt.Rows[i]["RechargeIsApprove"] != null && dt.Rows[i]["RechargeIsApprove"].ToString() != "") { if (dt.Rows[i]["RechargeIsApprove"].ToString() == "1" || dt.Rows[i]["RechargeIsApprove"].ToString().ToLower() == "true") { model.RechargeIsApprove = true; } else { model.RechargeIsApprove = false; } } if (dt.Rows[i]["RechargePoint"] != null && dt.Rows[i]["RechargePoint"].ToString() != "") { model.RechargePoint = int.Parse(dt.Rows[i]["RechargePoint"].ToString()); } modelList.Add(model); } } return(modelList); }
public int Add(Chain.Model.MemRecharge model) { return(this.dal.Add(model)); }