Esempio n. 1
0
        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();
                    }
                }
            }
        }
Esempio n. 2
0
 private void Membersrecharge(string memid, string total_fee, string jf, string GiveMoney, string out_trade_no, string time_end)
 {
     try
     {
         int     id        = int.Parse(memid);
         int     jifen     = int.Parse(jf);
         decimal givemoney = decimal.Parse(GiveMoney);
         decimal totalfee  = decimal.Parse(total_fee) / 100m;
         time_end = string.Format("{0}-{1}-{2} {3}:{4}:{5}", new object[]
         {
             time_end.Substring(0, 4),
             time_end.Substring(4, 2),
             time_end.Substring(6, 2),
             time_end.Substring(8, 2),
             time_end.Substring(10, 2),
             time_end.Substring(12, 2)
         });
         DateTime        timeend = DateTime.Parse(time_end);
         Chain.Model.Mem mem     = new Chain.Model.Mem();
         Chain.BLL.Mem   bllMem  = new Chain.BLL.Mem();
         mem           = bllMem.GetModel(id);
         mem.MemPoint += jifen;
         mem.MemMoney += totalfee + givemoney;
         bllMem.Update(mem);
         Chain.BLL.MemRecharge bllMemRecharge = new Chain.BLL.MemRecharge();
         bllMemRecharge.Add(new Chain.Model.MemRecharge
         {
             RechargeMemID       = id,
             RechargeAccount     = out_trade_no,
             RechargeMoney       = totalfee,
             RechargeShopID      = 1,
             RechargeUserID      = 1,
             RechargeCreateTime  = timeend,
             RechargeIsApprove   = true,
             RechargeRemark      = "会员微信充值",
             RechargePoint       = jifen,
             RechargeType        = 6,
             RechargeGive        = givemoney,
             RechargeCardBalance = mem.MemMoney
         });
         Chain.Model.MoneyChangeLog moneyChangeLogModel = new Chain.Model.MoneyChangeLog();
         moneyChangeLogModel.MoneyChangeMemID      = id;
         moneyChangeLogModel.MoneyChangeUserID     = 1;
         moneyChangeLogModel.MoneyChangeType       = 1;
         moneyChangeLogModel.MoneyChangeAccount    = out_trade_no;
         moneyChangeLogModel.MoneyChangeMoney      = totalfee + givemoney;
         moneyChangeLogModel.MemMoney              = mem.MemMoney;
         moneyChangeLogModel.MoneyChangeCreateTime = timeend;
         moneyChangeLogModel.MoneyChangeGiveMoney  = 0m;
         new Chain.BLL.MoneyChangeLog().Add(moneyChangeLogModel);
         if (jifen > 0)
         {
             Chain.Model.PointLog mdPoint = new Chain.Model.PointLog();
             mdPoint.PointMemID      = id;
             mdPoint.PointNumber     = jifen;
             mdPoint.PointChangeType = 15;
             mdPoint.PointRemark     = string.Concat(new object[]
             {
                 "会员充值,充值金额:[",
                 totalfee,
                 "],获得积分:[",
                 jifen,
                 "]"
             });
             mdPoint.PointShopID     = 1;
             mdPoint.PointCreateTime = timeend;
             mdPoint.PointUserID     = 1;
             mdPoint.PointOrderCode  = out_trade_no;
             new Chain.BLL.PointLog().Add(mdPoint);
             MEMPointUpdate.MEMPointRate(mem, jifen, out_trade_no, 15, 1, 1);
             PubFunction.UpdateMemLevel(mem);
         }
     }
     catch
     {
         return;
     }
     base.Response.Write(this.ToXml("SUCCESS", ""));
     base.Response.End();
 }
Esempio n. 3
0
 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("您还没有检验会员数据,请先检验数据");
         }
     }
 }
Esempio n. 4
0
        public List <Chain.Model.MoneyChangeLog> DataTableToList(DataTable dt)
        {
            List <Chain.Model.MoneyChangeLog> modelList = new List <Chain.Model.MoneyChangeLog>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                for (int i = 0; i < rowsCount; i++)
                {
                    Chain.Model.MoneyChangeLog model = new Chain.Model.MoneyChangeLog();
                    if (dt.Rows[i]["MoneyChangeID"] != null && dt.Rows[i]["MoneyChangeID"].ToString() != "")
                    {
                        model.MoneyChangeID = int.Parse(dt.Rows[i]["MoneyChangeID"].ToString());
                    }
                    if (dt.Rows[i]["MoneyChangeMemID"] != null && dt.Rows[i]["MoneyChangeMemID"].ToString() != "")
                    {
                        model.MoneyChangeMemID = int.Parse(dt.Rows[i]["MoneyChangeMemID"].ToString());
                    }
                    if (dt.Rows[i]["MoneyChangeUserID"] != null && dt.Rows[i]["MoneyChangeUserID"].ToString() != "")
                    {
                        model.MoneyChangeUserID = int.Parse(dt.Rows[i]["MoneyChangeUserID"].ToString());
                    }
                    if (dt.Rows[i]["MoneyChangeType"] != null && dt.Rows[i]["MoneyChangeType"].ToString() != "")
                    {
                        model.MoneyChangeType = int.Parse(dt.Rows[i]["MoneyChangeType"].ToString());
                    }
                    if (dt.Rows[i]["MoneyChangeAccount"] != null && dt.Rows[i]["MoneyChangeAccount"].ToString() != "")
                    {
                        model.MoneyChangeAccount = dt.Rows[i]["MoneyChangeAccount"].ToString();
                    }
                    if (dt.Rows[i]["MoneyChangeMoney"] != null && dt.Rows[i]["MoneyChangeMoney"].ToString() != "")
                    {
                        model.MoneyChangeMoney = decimal.Parse(dt.Rows[i]["MoneyChangeMoney"].ToString());
                    }
                    if (dt.Rows[i]["MoneyChangeCash"] != null && dt.Rows[i]["MoneyChangeCash"].ToString() != "")
                    {
                        model.MoneyChangeCash = decimal.Parse(dt.Rows[i]["MoneyChangeCash"].ToString());
                    }
                    if (dt.Rows[i]["MoneyChangeBalance"] != null && dt.Rows[i]["MoneyChangeBalance"].ToString() != "")
                    {
                        model.MoneyChangeBalance = decimal.Parse(dt.Rows[i]["MoneyChangeBalance"].ToString());
                    }
                    if (dt.Rows[i]["MoneyChangeUnionPay"] != null && dt.Rows[i]["MoneyChangeUnionPay"].ToString() != "")
                    {
                        model.MoneyChangeUnionPay = decimal.Parse(dt.Rows[i]["MoneyChangeUnionPay"].ToString());
                    }
                    if (dt.Rows[i]["MemMoney"] != null && dt.Rows[i]["MemMoney"].ToString() != "")
                    {
                        model.MemMoney = decimal.Parse(dt.Rows[i]["MemMoney"].ToString());
                    }
                    if (dt.Rows[i]["MoneyChangeCreateTime"] != null && dt.Rows[i]["MoneyChangeCreateTime"].ToString() != "")
                    {
                        model.MoneyChangeCreateTime = DateTime.Parse(dt.Rows[i]["MoneyChangeCreateTime"].ToString());
                    }
                    if (dt.Rows[i]["MoneyChangeGiveMoney"] != null && dt.Rows[i]["MoneyChangeGiveMoney"].ToString() != "")
                    {
                        model.MoneyChangeGiveMoney = decimal.Parse(dt.Rows[i]["MoneyChangeGiveMoney"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Esempio n. 5
0
 public bool Update(Chain.Model.MoneyChangeLog model)
 {
     return(this.dal.Update(model));
 }
Esempio n. 6
0
 public int Add(Chain.Model.MoneyChangeLog model)
 {
     return(this.dal.Add(model));
 }