Exemplo n.º 1
0
        /// <summary>
        /// 消费记录
        /// </summary>
        /// <param name="id">Uid</param>
        /// <param name="name">SourceAccountId</param>
        /// <param name="companyId">CompanyId</param>
        /// <returns></returns>
        public ActionResult ConsumptionRecords(string id, string name, string companyId)
        {
            List<PrepayRecord> p = null;
            try
            {
                Session["SourceAccountId"] = name;
                CrmMemberModel cmm = new CrmMemberModel();
                List<CrmMember> crm = cmm.getCrmMemberListInfoData(name);
                ViewBag.PrepayAccount = 0;
                if (crm.Count() > 0)
                {
                    decimal dec = cmm.GetPrepayAccount(crm.First().Uid).AccountMoney;
                    ViewBag.PrepayAccount = dec;
                }
                ViewBag.Uid = id;
                ViewBag.CompanyId = companyId;
                PrepayRecordModel prm = new PrepayRecordModel();
                p = prm.getConsumptionRecordsListInfoData(id);
            }
            catch
            {

            }
            finally
            {

            }

            return View(p);
        }
        public override IResponseMessageBase OnEvent_ClickRequest(RequestMessageEvent_Click requestMessage)
        {
            IResponseMessageBase reponseMessage = null;
            switch (requestMessage.EventKey)
            {
                case "BeginOrderClick":
                    {
                        var strongResponseMessage = CreateResponseMessage<ResponseMessageNews>();
                        strongResponseMessage.Articles.Add(new Article
                        {
                            Title = "开始预定",
                            Description = "通过微信预订点餐",
                            PicUrl = ImgUrl + "wxbeginorder.jpg",
                            Url = string.Format(Constants.HostDomain + "/order/begin/" + Constants.CompanyId + "/{0}?type=Quick", requestMessage.FromUserName)
                        });
                        reponseMessage = strongResponseMessage;
                    }
                    break;
                case "ActivityClick":
                    {
                        var strongResponseMessage = CreateResponseMessage<ResponseMessageNews>();
                        string picUrl = Constants.HostDomain + "/NewContent/images/w.png";
                        string uid = "";

                        try
                        {
                            CrmMemberModel model = new CrmMemberModel();
                            uid = model.getCrmMemberListInfoData(requestMessage.FromUserName).FirstOrDefault().Uid;
                            var prepayAccount = model.GetPrepayAccount(uid);
                            if (prepayAccount != null && prepayAccount.AccountMoney > 0)
                            {
                                picUrl = Constants.HostDomain + "/NewContent/images/chu.png";
                            }
                        }
                        catch (Exception ex)
                        {
                            LogException(ex);
                            uid = ex.StackTrace;
                        }
                        Article article = new Article();

                        article.Title = "小场合活动·微观时代";
                        article.Description = "小场合活动·微观时代";
                        article.PicUrl = picUrl;
                        article.Url = string.Format(Constants.HostDomain + "/Jump/To?fromUserName={0}&url=/Activity/Index?activityState=1", requestMessage.FromUserName);

                        strongResponseMessage.Articles.Add(article);

                        reponseMessage = strongResponseMessage;
                    }
                    break;
                case "AccountInfoClick":
                    {
                        var strongResponseMessage = CreateResponseMessage<ResponseMessageNews>();
                        string uid = string.Empty;
                        string picUrl = Constants.HostDomain + "/NewContent/images/w.png"; ;
                        try
                        {
                            CrmMemberModel model = new CrmMemberModel();
                            uid = model.getCrmMemberListInfoData(requestMessage.FromUserName).FirstOrDefault().Uid;
                            var prepayAccount = model.GetPrepayAccount(uid);
                            if (prepayAccount != null && prepayAccount.AccountMoney > 0)
                            {
                                picUrl = Constants.HostDomain + "/NewContent/images/chu.png";
                            }
                        }
                        catch (Exception ex)
                        {
                            LogException(ex);
                            uid = ex.StackTrace;
                        }
                        strongResponseMessage.Articles.Add(new Article
                        {
                            Title = "会员信息",
                            Description = "您的会员号:" + uid,
                            PicUrl = picUrl,
                            Url = string.Format(Constants.HostDomain + "/Member/Info/" + Constants.CompanyId + "/{0}", requestMessage.FromUserName)
                        });
                        reponseMessage = strongResponseMessage;
                    }
                    break;
                case "VipPay":
                    {
                        string picUrl = Constants.HostDomain + "/NewContent/images/w.png";
                        string uid = "";

                        try
                        {
                            CrmMemberModel model = new CrmMemberModel();
                            uid = model.getCrmMemberListInfoData(requestMessage.FromUserName).FirstOrDefault().Uid;
                            var prepayAccount = model.GetPrepayAccount(uid);
                            if (prepayAccount != null && prepayAccount.AccountMoney > 0)
                            {
                                picUrl = Constants.HostDomain + "/NewContent/images/chu.png";
                            }
                        }
                        catch (Exception ex)
                        {
                            LogException(ex);
                        }
                        var strongResponseMessage = CreateResponseMessage<ResponseMessageNews>();

                        DateTime dt = DateTime.Now.AddMinutes(-15);
                        PrepayRecord rec = new PrepayRecordModel().GetUserLastUnPaidComsumingPrepayRecordWithin5Minutes(requestMessage.FromUserName);
                        string description = string.Empty;
                        string title = string.Empty;
                        string url = "";

                        if (rec != null)
                        {
                            title = "支付确认";
                            description = "您本次的消费:现金¥" + (0 - rec.PrepayMoney.Value).ToString() +
                                 "/赠送¥" + (0 - rec.PresentMoney.Value).ToString() +
                                 (rec.PayByScore > 0 ? "/积分" + rec.PayByScore.ToString() : "") +
                                 (rec.DiscountlMoeny > 0 ? ",本次优惠:" + rec.DiscountlMoeny.ToString() : "") +
                                  ",账单时间:" + rec.PrepayDate.Value.ToString("yyyy-MM-dd HH:mm:ss") + ",点击本条消息,完成支付!";
                            url = string.Format(Constants.HostDomain + "/pay/payview/?id={0}&value={1}", requestMessage.FromUserName, rec.RecordId + "|" + DateTime.Now.Ticks);

                            strongResponseMessage.Articles.Add(new Article
                            {
                                Title = title,
                                Description = description,
                                PicUrl = picUrl,
                                Url = url
                            });
                            reponseMessage = strongResponseMessage;
                        }
                        else
                        {
                            description = "未查询到未结账单,可能原因为:\n1.您没有未结账单。\n2.您的账单还未生成。\n3.为保护您账号安全,您的生成的账单已经超期!";

                            var result = CreateResponseMessage<ResponseMessageText>();
                            result.Content = description;

                            reponseMessage = result;
                        }
                    }
                    break;
                case "MyOrder"://我的订单
                    {
                        var strongResponseMessage = CreateResponseMessage<ResponseMessageNews>();
                        string picUrl = Constants.HostDomain + "/NewContent/images/w.png";
                        string uid = "";

                        try
                        {
                            CrmMemberModel model = new CrmMemberModel();
                            uid = model.getCrmMemberListInfoData(requestMessage.FromUserName).FirstOrDefault().Uid;
                            var prepayAccount = model.GetPrepayAccount(uid);
                            if (prepayAccount != null && prepayAccount.AccountMoney > 0)
                            {
                                picUrl = Constants.HostDomain + "/NewContent/images/chu.png";
                            }
                        }
                        catch (Exception ex)
                        {
                            LogException(ex);
                            uid = ex.StackTrace;
                        }

                        strongResponseMessage.Articles.Add(new Article
                        {
                            Title = "我的订单",
                            Description = "我的订单:",
                            PicUrl = picUrl,
                            Url = string.Format(Constants.HostDomain + "/NewOrder/My/" + Constants.CompanyId + "/{0}", requestMessage.FromUserName)
                        });
                        reponseMessage = strongResponseMessage;
                    }
                    break;
                case "CompanyInfo"://成都印象餐饮有限公司
                    {
                        //TODO
                    }
                    break;
                case "Xiaochanghe"://成都印象小场合
                    {
                        //TODO
                    }
                    break;
                case "Culture"://小场合文化
                    {
                        //TODO
                    }
                    break;
                default:
                    {
                        var strongResponseMessage = CreateResponseMessage<ResponseMessageText>();
                        strongResponseMessage.Content = "您点击了按钮,EventKey:" + requestMessage.EventKey;
                        reponseMessage = strongResponseMessage;
                    }
                    break;
            }

            return reponseMessage;
        }
Exemplo n.º 3
0
        //充值记录
        public ActionResult RechargeRecord(string id, string name, string companyId)
        {
            List<PrepayRecord> p = null;
            try
            {
                ViewBag.Uid = id;
                PrepayRecordModel prm = new PrepayRecordModel();
                p = prm.getRechargeRecordListInfoData(id);
            }
            catch
            {

            }
            finally
            {

            }
            return View(p);
        }
Exemplo n.º 4
0
        public ActionResult CancelOrder(string uid, string orderId, bool isEdit)
        {
            ActionResult result = Content("FAILED");

            try
            {
                bool success = true;
                var orderManager = new OrderManager();
                var order = orderManager.GetOrderSummary(Guid.Parse(orderId));

                if (order != null)
                {
                    OrderModel orderModel = new OrderModel();

                    using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required))
                    {
                        PrepayRecordModel prepayRecordModel = new PrepayRecordModel();
                        CrmMemberModel crmMemberModel = new CrmMemberModel();

                        if (isEdit)
                        {
                            if (order.Status == OrderStatus.New)
                            {
                                success = orderModel.UpdateOrderStatus(Guid.Parse(orderId), OrderStatus.Cancelled);

                                var prepayRecord = prepayRecordModel.GetPrepayRecordByOrderId(orderId);

                                if (prepayRecord != null)
                                {
                                    //取消订单,支付失败
                                    prepayRecord.AsureDate = DateTime.Now;
                                    prepayRecord.RState = "99";
                                    success = success && prepayRecordModel.UpdatePrepayRecord(prepayRecord);
                                }
                            }
                            else
                            {
                                success = false;
                            }
                        }
                        else
                        {
                            if (OrderStatus.Paid == order.Status)
                            {
                                PrepayRecord prepayRecord = null;
                                PrepayRecord newPrepayRecord = null;
                                PrepayAccount prepayAccount = null;

                                prepayAccount = crmMemberModel.GetPrepayAccount(uid);
                                prepayRecord = prepayRecordModel.GetPrepayRecordByOrderId(orderId);

                                //已退款
                                prepayRecord.RState = "02";
                                prepayRecord.AsureDate = DateTime.Now;

                                newPrepayRecord = new PrepayRecord();

                                newPrepayRecord.AddMoney = -prepayRecord.AddMoney;
                                newPrepayRecord.AsureDate = DateTime.Now;
                                newPrepayRecord.BillPayId = Guid.NewGuid();
                                newPrepayRecord.DiscountlMoeny = 0;
                                newPrepayRecord.PayByScore = 0;
                                newPrepayRecord.PayModel = "02";
                                newPrepayRecord.PrepayDate = DateTime.Now;
                                newPrepayRecord.PrepayMoney = -0;
                                newPrepayRecord.PresentMoney = 0;
                                newPrepayRecord.PromotionId = 0;
                                newPrepayRecord.RecMoney = 0;
                                newPrepayRecord.RecordId = -1;
                                newPrepayRecord.RState = "";
                                newPrepayRecord.RstId = order.RestaurantId;
                                newPrepayRecord.ScoreVip = 0;
                                newPrepayRecord.SId = "";
                                newPrepayRecord.Uid = uid;
                                newPrepayRecord.UserId = "System";

                                prepayAccount.AccountMoney += newPrepayRecord.AddMoney.Value;
                                newPrepayRecord.PrepayDate = DateTime.Now;
                                newPrepayRecord.AsureDate = DateTime.Now;

                                success = orderModel.UpdateOrderStatus(Guid.Parse(orderId), OrderStatus.Refunded);
                                success = success && prepayRecordModel.AddPrepayRecord(newPrepayRecord);
                                success = success && crmMemberModel.UpdatePrepayAccount(prepayAccount);
                                success = success && prepayRecordModel.UpdatePrepayRecord(prepayRecord);
                            }
                            else
                            {
                                success = false;
                            }
                        }

                        if (success)
                        {
                            result = Content("SUCCESS");
                            scope.Complete();
                        }
                        else
                        {
                            result = Content("FAILED");
                            scope.Dispose();
                        }
                    }
                }
                else
                {
                    result = Content("FAILED");
                }
            }
            catch (Exception ex)
            {
                Logger.Log(ex);
            }

            return result;
        }
Exemplo n.º 5
0
        public bool JoinOnlineVipGroup(string uid, string verifyCode)
        {
            bool result = false;

            try
            {
                PrepayRecordModel prepayRecordModel = new PrepayRecordModel();
                CrmMemberModel crmMemberModel = new CrmMemberModel();

                PrepayRecord prepayRecord = null;
                PrepayAccount prepayAccount = null;

                prepayRecord = new PrepayRecord();
                prepayRecord.AddMoney = 30m;
                prepayRecord.AsureDate = DateTime.Now;
                prepayRecord.BillPayId = Guid.Empty;
                prepayRecord.DiscountlMoeny = 0;
                prepayRecord.PayByScore = 0;
                prepayRecord.PayModel = "00";
                prepayRecord.PrepayDate = DateTime.Now;
                prepayRecord.PrepayMoney = 0;
                prepayRecord.PresentMoney = 30m;
                prepayRecord.PromotionId = 0;
                prepayRecord.RecMoney = 0;
                prepayRecord.RecordId = -1;
                prepayRecord.RState = "01";
                prepayRecord.RstId = Guid.Empty;
                prepayRecord.ScoreVip = 0;
                prepayRecord.SId = "邀请码:" + verifyCode;
                prepayRecord.Uid = uid;
                prepayRecord.UserId = "JoinVipGroup";

                prepayAccount = crmMemberModel.GetPrepayAccount(uid);
                if (prepayAccount != null)
                {
                    prepayAccount.PresentMoney += 30m;
                    prepayAccount.TotalPresent += 30m;
                    prepayAccount.TotalMoney += 30m;
                }

                using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required))
                {
                    if (crmMemberModel.UpdatePrepayAccount(prepayAccount) &&
                        prepayRecordModel.AddPrepayRecord(prepayRecord))
                    {
                        result = true;
                        scope.Complete();
                    }
                    else
                    {
                        scope.Dispose();
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Log(ex);
            }

            return result;
        }
Exemplo n.º 6
0
        public bool JoinOnlineVipGroup(string uid, string verifyCode)
        {
            bool result = false;

            try
            {
                PrepayRecordModel prepayRecordModel = new PrepayRecordModel();
                CrmMemberModel    crmMemberModel    = new CrmMemberModel();

                PrepayRecord  prepayRecord  = null;
                PrepayAccount prepayAccount = null;

                prepayRecord                = new PrepayRecord();
                prepayRecord.AddMoney       = 30m;
                prepayRecord.AsureDate      = DateTime.Now;
                prepayRecord.BillPayId      = Guid.Empty;
                prepayRecord.DiscountlMoeny = 0;
                prepayRecord.PayByScore     = 0;
                prepayRecord.PayModel       = "00";
                prepayRecord.PrepayDate     = DateTime.Now;
                prepayRecord.PrepayMoney    = 0;
                prepayRecord.PresentMoney   = 30m;
                prepayRecord.PromotionId    = 0;
                prepayRecord.RecMoney       = 0;
                prepayRecord.RecordId       = -1;
                prepayRecord.RState         = "01";
                prepayRecord.RstId          = Guid.Empty;
                prepayRecord.ScoreVip       = 0;
                prepayRecord.SId            = "邀请码:" + verifyCode;
                prepayRecord.Uid            = uid;
                prepayRecord.UserId         = "JoinVipGroup";

                prepayAccount = crmMemberModel.GetPrepayAccount(uid);
                if (prepayAccount != null)
                {
                    prepayAccount.PresentMoney += 30m;
                    prepayAccount.TotalPresent += 30m;
                    prepayAccount.TotalMoney   += 30m;
                }

                using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required))
                {
                    if (crmMemberModel.UpdatePrepayAccount(prepayAccount) &&
                        prepayRecordModel.AddPrepayRecord(prepayRecord))
                    {
                        result = true;
                        scope.Complete();
                    }
                    else
                    {
                        scope.Dispose();
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Log(ex);
            }

            return(result);
        }