Exemplo n.º 1
0
    protected void Save_Btn_Click(object sender, EventArgs e)
    {
        M_UserInfo mu = buser.GetLogin();

        if (Mid > 0)
        {
            regularMod = regularBll.SelReturnModel(Mid);
        }
        regularMod.Alias = Alias_T.Text.Trim();
        regularMod.Min   = DataConvert.CDouble(Min_T.Text);
        if (regularMod.Min <= 0)
        {
            function.WriteErrMsg("充值金额不能为0");
        }
        regularMod.Purse       = DataConvert.CDouble(Purse_T.Text);
        regularMod.Point       = DataConvert.CDouble(Point_T.Text);
        regularMod.AdminRemind = AdminRemind_T.Text.Trim();
        regularMod.AdminID     = regularMod.AdminID;
        if (Mid > 0)
        {
            regularMod.EditDate = DateTime.Now;
            regularBll.UpdateByID(regularMod);
        }
        else
        {
            regularMod.StoreID = mu.SiteID;
            //if (regularBll.IsExist(regularMod.Min)) { function.WriteErrMsg("充值金额[" + regularMod.Min.ToString("f2") + "]的规则已存在,不可重复添加"); }
            regularBll.Insert(regularMod);
        }
        function.WriteSuccessMsg("保存成功", "MoneyRegular.aspx");
    }
 private void MyBind()
 {
     if (Mid > 0)
     {
         regularMod         = regularBll.SelReturnModel(Mid);
         Min_T.Text         = regularMod.Min.ToString("f2");
         Purse_T.Text       = regularMod.Purse.ToString("f2");
         SIcon_T.Text       = regularMod.Sicon.ToString("f2");
         Point_T.Text       = regularMod.Point.ToString("f2");
         UserRemind_T.Text  = regularMod.UserRemind;
         AdminRemind_T.Text = regularMod.AdminRemind;
     }
 }
Exemplo n.º 3
0
    private void MyBind()
    {
        M_UserInfo mu = buser.GetLogin();

        if (Mid > 0)
        {
            regularMod = regularBll.SelReturnModel(Mid);
            if (regularMod.StoreID != mu.SiteID)
            {
                function.WriteErrMsg("你无权访问该信息");
            }
            Alias_T.Text       = regularMod.Alias;
            Min_T.Text         = regularMod.Min.ToString("f2");
            Purse_T.Text       = regularMod.Purse.ToString("f2");
            Point_T.Text       = regularMod.Point.ToString("f2");
            AdminRemind_T.Text = regularMod.AdminRemind;
        }
    }
Exemplo n.º 4
0
 /// <summary>
 /// 用于订单支持后的回调页,根据充值金额对其赠送
 /// </summary>
 public void AddMoneyByMin(M_UserInfo mu, double money, string addon) 
 {
     B_User buser = new B_User();
     M_Shop_MoneyRegular regularMod = SelModelByMin(money);
     if (regularMod != null)
     {
         string remind = regularMod.UserRemind + "," + addon;
         if (regularMod.Purse > 0)
         {
             buser.AddMoney(mu.UserID, regularMod.Purse, M_UserExpHis.SType.Purse, remind);
         }
         if (regularMod.Sicon > 0)
         {
             buser.AddMoney(mu.UserID, regularMod.Sicon, M_UserExpHis.SType.SIcon, remind);
         }
         if (regularMod.Point > 0)
         {
             buser.AddMoney(mu.UserID, regularMod.Point, M_UserExpHis.SType.Point, remind);
         }
     }
 }
Exemplo n.º 5
0
 public int Insert(M_Shop_MoneyRegular model)
 {
     return(DBCenter.Insert(model));
 }
Exemplo n.º 6
0
 public bool UpdateByID(M_Shop_MoneyRegular model)
 {
     return(DBCenter.UpdateByID(model, model.ID));
 }
Exemplo n.º 7
0
        public static void OrderFinish(M_OrderList mod, M_Payment pinfo)
        {
            B_OrderList orderBll = new B_OrderList();
            B_CartPro   cpBll    = new B_CartPro();
            B_User      buser    = new B_User();

            //B_User_Card cdBll = new B_User_Card();
            //B_User_StoreUser suBll = new B_User_StoreUser();
            switch (mod.Ordertype)
            {
            case (int)M_OrderList.OrderEnum.Domain:
            {
                B_Shop_MoneyRegular regBll = new B_Shop_MoneyRegular();
                //M_User_StoreUser suMod = suBll.SelReturnModel(Convert.ToInt32(mod.Receiver));
                //M_User_Card cdMod = cdBll.SelModelByUid(suMod.ID);
                //cdMod.CardPurse += mod.Ordersamount;
                //cdBll.UpdateByID(cdMod);
                int regular = DataConvert.CLng(mod.Money_code);
                M_Shop_MoneyRegular regMod = null;
                if (regular > 0)
                {
                    regMod = regBll.SelReturnModel(regular);
                }
                else
                {
                    regMod     = new M_Shop_MoneyRegular();
                    regMod.Min = mod.Ordersamount;
                }
                buser.AddMoney(DataConvert.CLng(mod.Receiver), regMod.Min + regMod.Purse, M_UserExpHis.SType.Purse, "充值,订单号:" + mod.OrderNo + ",充值:" + regMod.Min + ",赠送:" + regMod.Purse);
                if (regMod.Point > 0)
                {
                    buser.AddMoney(DataConvert.CLng(mod.Receiver), regMod.Point, M_UserExpHis.SType.Point, "充值赠送积分,订单号:" + mod.OrderNo);
                }
            }
            break;

            case (int)M_OrderList.OrderEnum.Cloud:    //通过微信下的预约订单
            {
                //付款后增加预约记录,由收银员完成开单
                //{ id: 0, proid: 0, proname: "", empid: 0, empname: "" };
                DataTable cpDT = cpBll.SelByOrderID(mod.id);
                List <M_Ex_PreOrder_Item> itemList = new List <M_Ex_PreOrder_Item>();
                foreach (DataRow dr in cpDT.Rows)
                {
                    M_Ex_PreOrder_Item model = new M_Ex_PreOrder_Item();
                    model.proid   = Convert.ToInt32(dr["ProID"]);
                    model.proname = DataConvert.CStr(dr["Proname"]);
                    model.empid   = DataConvert.CLng(dr["code"]);
                    model.empname = DataConvert.CStr(dr["Proinfo"]);
                    itemList.Add(model);
                }
                B_Ex_PreOrder poBll = new B_Ex_PreOrder();
                M_Ex_PreOrder poMod = new M_Ex_PreOrder();
                poMod.ClientMobile = mod.Mobile.ToString();
                poMod.ClientName   = mod.Rename;
                poMod.ClientDate   = DataConvert.CDate(mod.ExpTime);
                poMod.ClientNeed   = JsonConvert.SerializeObject(itemList);
                poMod.Remark       = mod.Ordermessage;
                poMod.Source       = "微信";
                poMod.OrderID      = mod.id;
                poMod.ID           = poBll.Insert(poMod);
            }
            break;

            default:    //普通订单,计算提成,赠送积分
            {
                B_Shop_Bonus bnBll = new B_Shop_Bonus();
                DataTable    cpDT  = cpBll.SelByOrderID(mod.id);
                foreach (DataRow dr in cpDT.Rows)
                {
                    int    code     = DataConvert.CLng(dr["code"]);
                    int    proid    = DataConvert.CLng(dr["Proid"]);
                    double allMoney = DataConvert.CDouble(dr["AllMoney"]);
                    if (code < 1)
                    {
                        continue;
                    }
                    #region 技师计算提成
                    //技师绑定了何种分成方案,
                    M_UserInfo   jsMod = buser.SelReturnModel(code);
                    M_Shop_Bonus bnMod = null;
                    if (jsMod.VIP < 1)
                    {
                        bnMod = bnBll.SelModelByDefault();
                    }
                    else
                    {
                        bnMod = bnBll.SelReturnModel(jsMod.VIP);
                    }
                    //无提成方案则不计算
                    if (bnMod != null)
                    {
                        //根据商品ID,看有无匹配的子数据类型
                        M_Shop_Bonus bnMod2 = bnBll.SelModelByProID(bnMod.ID, proid);
                        if (bnMod2 != null)
                        {
                            bnMod = bnMod2;
                        }
                        //-------计算提成,写入CartPro中
                        double bonus = 0;
                        switch (bnMod.BonusType)
                        {
                        case 0:
                            bonus = allMoney * (DataConvert.CDouble(bnMod.BonusValue1) * 0.01);
                            break;

                        case 1:
                            bonus = DataConvert.CDouble(bnMod.BonusValue1);
                            break;
                        }
                        DBCenter.UpdateSQL("ZL_CartPro", "AllMoney_Json='" + bonus.ToString("F2") + "'", "ID=" + dr["ID"]);
                    }
                    #endregion
                }
                //-------赠送积分,默认每一元送一分
                buser.AddMoney(DataConvert.CLng(mod.Receiver), mod.Receivablesamount, M_UserExpHis.SType.Point, "订单[" + mod.id + "]赠送积分");
            }
            break;
            }
        }
Exemplo n.º 8
0
 /// <summary>
 /// 异步回调后-->验证支付单状态-->如果正常,更新订单状态
 /// 多张订单在外层循环,这里只处理单订单
 /// </summary>
 /// <param name="mod">订单模型</param>
 /// <param name="paylogMod">订单支付日志模型</param>
 public static void FinalStep(M_Payment pinfo, M_OrderList mod, M_Order_PayLog paylogMod)
 {
     //B_Order_PayLog paylogBll = new B_Order_PayLog();
     B_PayPlat platBll = new B_PayPlat();
     B_Payment payBll  = new B_Payment();
     B_User    buser   = new B_User();
     //[*]特殊处理,预付与尾款逻辑
     {
         #region
         if (pinfo.PayType == (int)M_OrderList.PayTypeEnum.PrePay)
         {
             M_PrePayinfo preInfo = new M_PrePayinfo(pinfo.PrePayInfo);
             preInfo.money_pre_payed = pinfo.MoneyTrue;
             preInfo.pre_payno       = pinfo.PayNo;
             preInfo.pre_payMethod   = platBll.GetPayPlatName(pinfo);
             pinfo.PrePayInfo        = JsonConvert.SerializeObject(preInfo);
             DBCenter.UpdateSQL(pinfo.TbName, "PrePayInfo=@preInfo", "PayMentID=" + pinfo.PaymentID,
                                new List <SqlParameter>()
             {
                 new SqlParameter("preInfo", pinfo.PrePayInfo)
             });
         }
         else if (pinfo.PayType == (int)M_OrderList.PayTypeEnum.AfterPay)
         {
             try
             {
                 M_OrderList realOrder = orderBll.SelModelByOrderNo(mod.Ordermessage);
                 M_Payment   preMod    = payBll.SelModelByPayNo(realOrder.PaymentNo);
                 //修改订单与支付单信息
                 M_PrePayinfo preInfo = new M_PrePayinfo(preMod.PrePayInfo);
                 preInfo.money_after_payed = pinfo.MoneyTrue;
                 preInfo.status            = (int)ZLEnum.ConStatus.Audited;
                 preInfo.after_payno       = pinfo.PayNo;
                 preInfo.after_payMethod   = platBll.GetPayPlatName(pinfo);
                 //修改二张订单与二张支付单的状态
                 realOrder.IsCount            = true;
                 realOrder.Ordersamount      += pinfo.MoneyTrue;
                 realOrder.Receivablesamount += pinfo.MoneyTrue;
                 orderBll.UpdateByID(realOrder);
                 mod.OrderStatus   = 99;
                 mod.Paymentstatus = 1;
                 mod.PaymentNo     = pinfo.PayNo;
                 orderBll.UpdateByID(mod);
                 DBCenter.UpdateSQL(preMod.TbName, "PrePayInfo=@preInfo", "PayMentID=" + preMod.PaymentID,
                                    new List <SqlParameter>()
                 {
                     new SqlParameter("preInfo", JsonConvert.SerializeObject(preInfo))
                 });
                 return;
             }
             catch (Exception ex)
             {
                 ZLLog.L(Model.ZLEnum.Log.pay, new M_Log()
                 {
                     Action  = "支付尾款异常",
                     Message = "订单号:" + mod.OrderNo + ",支付单:" + pinfo.PayNo + ",原因:" + ex.Message
                 });
                 return;
             }
         }
         #endregion
     }
     //订单已处理,避免重复(如已处理过,则继续处理下一张订单)
     if (mod.OrderStatus >= 99)
     {
         ZLLog.L(Model.ZLEnum.Log.pay, new M_Log()
         {
             Action  = "支付回调异常,订单状态已为99",
             Message = "订单号:" + mod.OrderNo + ",支付单:" + pinfo.PayNo
         });
         return;
     }
     //已经收到钱了,所以先执行(如多订单,则为订单金额)
     if (mod.Receivablesamount <= 0)
     {
         //DD201701112113293112618,DD201701112113293754790
         int orderNum = pinfo.PaymentNum.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).Length;
         if (orderNum == 1)
         {
             mod.Receivablesamount = pinfo.MoneyTrue;
         }
         else
         {
             //订单需要改进,支持优惠后的金额等,不能只以支付单中的为准,每张订单需要计算出自己的优惠额与积分支付额
             mod.Receivablesamount = mod.Ordersamount;
         }
     }
     orderBll.UpOrderinfo("Paymentstatus=1,Receivablesamount=" + mod.Receivablesamount, mod.id);
     //if (mod.Ordertype == (int)M_OrderList.OrderEnum.Domain)//域名订单
     //{
     //    orderBll.UpOrderinfo("OrderStatus=1,PaymentNo='" + pinfo.PayNo + "'", mod.id);
     //    //Response.Redirect("~/Plugins/Domain/DomReg2?OrderNo=" + mod.OrderNo);
     //}
     //else if (mod.Ordertype == (int)M_OrderList.OrderEnum.IDC)//IDC服务
     //{
     //    B_Order_IDC idcBll = new B_Order_IDC();
     //    orderBll.FinishOrder(mod.id, pinfo);
     //    idcBll.UpdateEndTimeByNo(mod.OrderNo);
     //}
     //else if ((mod.Ordertype == (int)M_OrderList.OrderEnum.IDCRen))//IDC服务续费
     //{
     //    B_Order_IDC idcBll = new B_Order_IDC();
     //    orderBll.FinishOrder(mod.id, pinfo);
     //    idcBll.RennewTime(mod);
     //}
     if (mod.Ordertype == (int)M_OrderList.OrderEnum.Purse)//余额充值,不支持银币
     {
         buser.AddMoney(mod.Userid, mod.Ordersamount,
                        M_UserExpHis.SType.Purse, "余额充值,订单号:" + mod.OrderNo);
         //检测是否采用了充值赠送规则
         if (DataConvert.CLng(mod.Money_code) > 0)
         {
             B_Shop_MoneyRegular regBll = new B_Shop_MoneyRegular();
             M_Shop_MoneyRegular regMod = regBll.SelReturnModel(DataConvert.CLng(mod.Money_code));
             if (regMod.Purse > 0)
             {
                 buser.AddMoney(mod.Userid, regMod.Purse,
                                M_UserExpHis.SType.Purse, "余额充值--余额赠送,订单号:" + mod.OrderNo);
             }
             if (regMod.Sicon > 0)
             {
                 buser.AddMoney(mod.Userid, regMod.Sicon,
                                M_UserExpHis.SType.SIcon, "余额充值--银币赠送,订单号:" + mod.OrderNo);
             }
             if (regMod.Point > 0)
             {
                 buser.AddMoney(mod.Userid, regMod.Point,
                                M_UserExpHis.SType.Point, "余额充值--积分赠送,订单号:" + mod.OrderNo);
             }
         }
         orderBll.FinishOrder(mod.id, pinfo);                    //成功的订单
     }
     else if (mod.Ordertype == (int)M_OrderList.OrderEnum.Cloud) //虚拟商品订单
     {
         orderBll.FinishOrder(mod.id, pinfo);
     }
     else//其他旅游订单等,只更新状态
     {
         orderBll.FinishOrder(mod.id, pinfo);//成功的订单
     }
     //-------支付成功处理,快照并写入日志
     SaveSnapShot(mod);
     //paylogMod.Remind += "订单" + mod.OrderNo + "购买生效";
     //paylogMod.UserID = mod.Userid;
     //paylogMod.OrderID = mod.id;
     //paylogMod.PayMoney = mod.Ordersamount;
     //paylogMod.PayMethod = (int)M_Order_PayLog.PayMethodEnum.Other;//外部指定
     //paylogMod.PayPlatID = pinfo.PayPlatID;
     //paylogBll.insert(paylogMod);
     //------商品是否赠送积分
     //{//好酒多积分不直接入账
     //    DataTable prodt = DBCenter.JoinQuery("A.ProID,A.Pronum,B.PointVal", "ZL_CartPro", "ZL_Commodities", "A.ProID=B.ID", "A.OrderListID=" + mod.id);
     //    foreach (DataRow dr in prodt.Rows)
     //    {
     //        double point = DataConvert.CDouble(dr["PointVal"])*Convert.ToInt32(dr["Pronum"]);
     //        if (point > 0)
     //        {
     //            buser.AddMoney(mod.Userid, point, M_UserExpHis.SType.Point, "购买商品[" + dr["ProID"] + "],赠送积分");
     //        }
     //    }
     //}
     if (OrderFinish_Event != null)
     {
         OrderFinish_Event(mod, pinfo);
     }
 }