예제 #1
0
        public List <Chain.Model.PointLog> DataTableToList(DataTable dt)
        {
            List <Chain.Model.PointLog> modelList = new List <Chain.Model.PointLog>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                for (int i = 0; i < rowsCount; i++)
                {
                    Chain.Model.PointLog model = new Chain.Model.PointLog();
                    if (dt.Rows[i]["PointID"] != null && dt.Rows[i]["PointID"].ToString() != "")
                    {
                        model.PointID = int.Parse(dt.Rows[i]["PointID"].ToString());
                    }
                    if (dt.Rows[i]["PointMemID"] != null && dt.Rows[i]["PointMemID"].ToString() != "")
                    {
                        model.PointMemID = int.Parse(dt.Rows[i]["PointMemID"].ToString());
                    }
                    if (dt.Rows[i]["PointNumber"] != null && dt.Rows[i]["PointNumber"].ToString() != "")
                    {
                        model.PointNumber = int.Parse(dt.Rows[i]["PointNumber"].ToString());
                    }
                    if (dt.Rows[i]["PointChangeType"] != null && dt.Rows[i]["PointChangeType"].ToString() != "")
                    {
                        model.PointChangeType = int.Parse(dt.Rows[i]["PointChangeType"].ToString());
                    }
                    if (dt.Rows[i]["PointRemark"] != null && dt.Rows[i]["PointRemark"].ToString() != "")
                    {
                        model.PointRemark = dt.Rows[i]["PointRemark"].ToString();
                    }
                    if (dt.Rows[i]["PointShopID"] != null && dt.Rows[i]["PointShopID"].ToString() != "")
                    {
                        model.PointShopID = int.Parse(dt.Rows[i]["PointShopID"].ToString());
                    }
                    if (dt.Rows[i]["PointCreateTime"] != null && dt.Rows[i]["PointCreateTime"].ToString() != "")
                    {
                        model.PointCreateTime = DateTime.Parse(dt.Rows[i]["PointCreateTime"].ToString());
                    }
                    if (dt.Rows[i]["PointUserID"] != null && dt.Rows[i]["PointUserID"].ToString() != "")
                    {
                        model.PointUserID = int.Parse(dt.Rows[i]["PointUserID"].ToString());
                    }
                    if (dt.Rows[i]["PointOrderCode"] != null && dt.Rows[i]["PointOrderCode"].ToString() != "")
                    {
                        model.PointOrderCode = dt.Rows[i]["PointOrderCode"].ToString();
                    }
                    if (dt.Rows[i]["PointGiveMemID"] != null && dt.Rows[i]["PointGiveMemID"].ToString() != "")
                    {
                        model.PointGiveMemID = Convert.ToInt32(dt.Rows[i]["PointGiveMemID"]);
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
예제 #2
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();
                    }
                }
            }
        }
예제 #3
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();
 }
예제 #4
0
    public static void PointRateUpdate(Chain.Model.Mem mem, int point, int pointType, int mymemID, Chain.Model.SysUser User, string OrderAccount)
    {
        if (MEMPointUpdate.NowRateLevel <= MEMPointUpdate.RateLevel && mem.MemRecommendID != 0)
        {
            Chain.Model.Mem TEMPMEM = MEMPointUpdate.bll.GetModel(mem.MemRecommendID);
            if (TEMPMEM != null)
            {
                int temp = 0;
                if (MEMPointUpdate.RateType)
                {
                    temp = Convert.ToInt32(decimal.Truncate(point * (MEMPointUpdate.MEMRate[MEMPointUpdate.NowRateLevel - 1] / 100m)));
                }
                else
                {
                    temp = Convert.ToInt32(MEMPointUpdate.MEMRate[MEMPointUpdate.NowRateLevel - 1]);
                }
                if (PubFunction.IsShopPoint(User.UserShopID, ref temp))
                {
                    TEMPMEM.MemPoint += temp;
                    int flag = MEMPointUpdate.bll.Update(TEMPMEM);
                    MEMPointUpdate.sumPoint += temp;
                    if (flag == 1)
                    {
                        PubFunction.UpdateMemLevel(TEMPMEM);
                        Chain.Model.PointLog modelPoint = new Chain.Model.PointLog();
                        modelPoint.PointMemID      = TEMPMEM.MemID;
                        modelPoint.PointNumber     = temp;
                        modelPoint.PointChangeType = 9;
                        modelPoint.PointShopID     = TEMPMEM.MemShopID;
                        modelPoint.PointCreateTime = DateTime.Now;
                        modelPoint.PointUserID     = TEMPMEM.MemUserID;
                        modelPoint.PointOrderCode  = MEMPointUpdate.PointOrderCode;
                        modelPoint.PointGiveMemID  = mymemID;
                        switch (pointType)
                        {
                        case -1:
                            modelPoint.PointRemark = string.Concat(new object[]
                            {
                                "卡号:",
                                MEMPointUpdate.MEMCard,
                                ",姓名:",
                                MEMPointUpdate.MEMName,
                                "的会员商品消费退货,获得积分:[",
                                temp,
                                "]"
                            });
                            break;

                        case 0:
                        case 4:
                            break;

                        case 1:
                            modelPoint.PointRemark = string.Concat(new object[]
                            {
                                "卡号:",
                                MEMPointUpdate.MEMCard,
                                ",姓名:",
                                MEMPointUpdate.MEMName,
                                "的会员商品消费,获得积分:[",
                                temp,
                                "]"
                            });
                            break;

                        case 2:
                            modelPoint.PointRemark = string.Concat(new object[]
                            {
                                "卡号:",
                                MEMPointUpdate.MEMCard,
                                ",姓名:",
                                MEMPointUpdate.MEMName,
                                "的会员快速消费,获得积分:[",
                                temp,
                                "]"
                            });
                            break;

                        case 3:
                            modelPoint.PointRemark = string.Concat(new object[]
                            {
                                "卡号:",
                                MEMPointUpdate.MEMCard,
                                ",姓名:",
                                MEMPointUpdate.MEMName,
                                "的会员充次,获得积分:[",
                                temp,
                                "]"
                            });
                            break;

                        case 5:
                            modelPoint.PointRemark = string.Concat(new object[]
                            {
                                "卡号:",
                                MEMPointUpdate.MEMCard,
                                ",姓名:",
                                MEMPointUpdate.MEMName,
                                "的会员注册,获得积分:[",
                                temp,
                                "]"
                            });
                            break;

                        case 6:
                            modelPoint.PointRemark = string.Concat(new object[]
                            {
                                "卡号:",
                                MEMPointUpdate.MEMCard,
                                ",姓名:",
                                MEMPointUpdate.MEMName,
                                "的会员手动增加积分,获得积分:[",
                                temp,
                                "]"
                            });
                            break;

                        default:
                            switch (pointType)
                            {
                            case 14:
                                modelPoint.PointRemark = string.Concat(new object[]
                                {
                                    "卡号:",
                                    MEMPointUpdate.MEMCard,
                                    ",姓名:",
                                    MEMPointUpdate.MEMName,
                                    "的会员充时增加积分,获得积分:[",
                                    temp,
                                    "]"
                                });
                                break;

                            case 15:
                                modelPoint.PointRemark = string.Concat(new object[]
                                {
                                    "卡号:",
                                    MEMPointUpdate.MEMCard,
                                    ",姓名:",
                                    MEMPointUpdate.MEMName,
                                    "的会员充值增加积分,获得积分:[",
                                    temp,
                                    "]"
                                });
                                break;
                            }
                            break;
                        }
                        Chain.BLL.PointLog bllPoint = new Chain.BLL.PointLog();
                        bllPoint.Add(modelPoint);
                        PubFunction.SaveSysLog(TEMPMEM.MemUserID, 3, "会员积分提成", "会员" + TEMPMEM.MemName + "积分提成成功", TEMPMEM.MemShopID, DateTime.Now, PubFunction.ipAdress);
                    }
                    MEMPointUpdate.NowRateLevel++;
                    MEMPointUpdate.PointRateUpdate(TEMPMEM, point, pointType, mymemID, User, OrderAccount);
                }
            }
        }
    }
예제 #5
0
 public bool Update(Chain.Model.PointLog model)
 {
     return(this.dal.Update(model));
 }
예제 #6
0
 public int Add(Chain.Model.PointLog model)
 {
     return(this.dal.Add(model));
 }