Пример #1
0
        public ActionResult ActivityPosition(string Id)
        {
            pbs_basic_GoodsView pbsBasicGoodsView = new pbs_basic_GoodsView();
            int gid = Utility.Util.ParseHelper.ToInt(Id);
            pbs_basic_GoodsService           pbsBasicGoodsService = new pbs_basic_GoodsService();
            ResultInfo <pbs_basic_GoodsView> result = pbsBasicGoodsService.GetGoodsModelViewById(gid);

            if (result.Result && result.Data != null)
            {
                pbsBasicGoodsView = result.Data;
            }
            return(View(pbsBasicGoodsView));
        }
Пример #2
0
        public ActionResult Buy(string orderId, string voucherId)
        {
            int    oId         = Utility.Util.ParseHelper.ToInt(orderId);
            int    vId         = Utility.Util.ParseHelper.ToInt(voucherId);
            string voucherName = string.Empty;
            pbs_basic_GoodsView pbsBasicGoodsView = new pbs_basic_GoodsView();
            pbs_basic_Order     order             = new pbs_basic_Order();
            pbs_basic_Members   members           = new pbs_basic_Members();
            pbs_basic_Voucher   voucher           = new pbs_basic_Voucher();
            //pbs_basic_OrderMember orderMember = new pbs_basic_OrderMember();
            pbs_basic_MembersService pbsBasicMembersService = new pbs_basic_MembersService();
            pbs_basic_OrderService   pbsBasicOrderService   = new pbs_basic_OrderService();
            pbs_basic_GoodsService   pbsBasicGoodsService   = new pbs_basic_GoodsService();
            pbs_basic_VoucherService pbsBasicVoucherService = new pbs_basic_VoucherService();
            //pbs_basic_OrderMemberService pbsBasicOrderMemberService = new pbs_basic_OrderMemberService();


            ResultInfo <pbs_basic_Order> result_order = pbsBasicOrderService.GetOrderModelById(oId);

            if (result_order.Result && result_order.Data != null)
            {
                order = result_order.Data;
                ResultInfo <pbs_basic_GoodsView> result_GoodsView = pbsBasicGoodsService.GetGoodsModelViewById(order.GoodsId);
                if (result_GoodsView.Result && result_GoodsView.Data != null)
                {
                    pbsBasicGoodsView = result_GoodsView.Data;
                }

                ResultInfo <pbs_basic_Members> result_Member = pbsBasicMembersService.GetMembersModelById(Utility.Util.ParseHelper.ToInt(order.OrderMemberId));
                if (result_Member.Result && result_Member.Data != null)
                {
                    members = result_Member.Data;
                }

                if (vId != 0)
                {
                    ResultInfo <pbs_basic_Voucher> result_Voucher = pbsBasicVoucherService.GetVoucherModelById(vId);
                    if (result_Voucher.Result && result_Voucher.Data != null)
                    {
                        voucherName = result_Voucher.Data.VoucherPrice.ToString();
                    }
                }
            }

            ViewData["GoodsView"]   = pbsBasicGoodsView;
            ViewData["Order"]       = order;
            ViewData["Members"]     = members;
            ViewData["VoucherId"]   = vId;
            ViewData["VoucherName"] = voucherName;
            return(View());
        }
Пример #3
0
        // GET: Activity
        public ActionResult Activity(string Id, string fromShareUserId)
        {
            pbs_basic_GoodsView pbsBasicGoodsView = new pbs_basic_GoodsView();
            int gid = Utility.Util.ParseHelper.ToInt(Id);
            pbs_basic_GoodsService           pbsBasicGoodsService = new pbs_basic_GoodsService();
            ResultInfo <pbs_basic_GoodsView> result = pbsBasicGoodsService.GetGoodsModelViewById(gid);

            if (result.Result && result.Data != null)
            {
                pbsBasicGoodsView = result.Data;
            }

            if (!string.IsNullOrEmpty(fromShareUserId) && fromShareUserId != "0")
            {
                if (fromShareUserId.Contains(userid.ToString()))
                {
                    fromShareUserId = fromShareUserId.Replace(userid.ToString() + ",", "");
                }

                Session["FromShareUserId"] = fromShareUserId;
            }
            else
            {
                Session["FromShareUserId"] = userid + ",";
            }
            string link = System.Configuration.ConfigurationManager.AppSettings["PhotoPicSourceHostUrl"].ToString() + "/Activity/Activity?Id=" + Id + "&fromShareUserId=" + Session["FromShareUserId"].ToString();

            ViewData["Link"] = link;

            #region 微信分享
            string token     = string.Empty;
            string ticket    = string.Empty;
            string timestamp = string.Empty;
            string nonceStr  = string.Empty;
            string signature = string.Empty;
            if (Session["Token"] != null && Session["TokenTime"] != null)
            {
                DateTime dt1   = DateTime.Now;
                DateTime dt2   = Utility.Util.ParseHelper.ToDatetime(Session["TokenTime"].ToString());
                TimeSpan ts    = dt1 - dt2;
                string   tsSen = ts.Seconds.ToString();
                if (Utility.Util.ParseHelper.ToInt(tsSen) < 7200)
                {
                    token     = Session["Token"].ToString();
                    ticket    = Session["Ticket"].ToString();
                    timestamp = Session["TimeStamp"].ToString();
                    nonceStr  = Session["NonceStr"].ToString();
                    signature = JSSDKHelper.GetSignature(ticket, nonceStr, timestamp, Request.Url.AbsoluteUri);
                    LogUtil.WriteLog("tsSen:" + tsSen);
                    LogUtil.WriteLog("Session Token:" + token);
                    LogUtil.WriteLog("Session Ticket:" + ticket);
                    LogUtil.WriteLog("Session TimeStamp:" + timestamp);
                    LogUtil.WriteLog("Session NonceStr:" + nonceStr);
                    LogUtil.WriteLog("Session SigNature:" + signature);
                }
            }
            if (string.IsNullOrEmpty(token))
            {
                #region 获取token
                string token_url   = string.Format("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={0}&secret={1}", PayConfig.AppId, PayConfig.AppSecret);
                string returnToken = HttpUtil.Send("", token_url);
                var    tokenModel  = JsonConvert.DeserializeObject <tokenModel>(returnToken);
                token = tokenModel.access_token;
                #endregion

                #region 获取ticket
                string ticket_url   = string.Format("https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token={0}&type=jsapi", token);
                string returnTicket = HttpUtil.Send("", ticket_url);
                var    ticketModel  = JsonConvert.DeserializeObject <ticketModel>(returnTicket);
                ticket = ticketModel.ticket;
                #endregion

                //获取时间戳
                timestamp = JSSDKHelper.GetTimestamp();
                //获取随机码
                nonceStr = JSSDKHelper.GetNoncestr();
                //获取签名
                signature            = JSSDKHelper.GetSignature(ticket, nonceStr, timestamp, Request.Url.AbsoluteUri);
                Session["Token"]     = token;
                Session["TokenTime"] = DateTime.Now;
                Session["Ticket"]    = ticket;
                Session["TimeStamp"] = timestamp;
                Session["NonceStr"]  = nonceStr;

                LogUtil.WriteLog("First Ticket:" + ticket);
                LogUtil.WriteLog("First TimeStamp:" + timestamp);
                LogUtil.WriteLog("First NonceStr:" + nonceStr);
                LogUtil.WriteLog("First SigNature:" + signature);
                LogUtil.WriteLog("Request Url:" + Request.Url.AbsoluteUri);
            }

            ViewData["AppId"]     = PayConfig.AppId;
            ViewData["Timestamp"] = timestamp;
            ViewData["NonceStr"]  = nonceStr;
            ViewData["Signature"] = signature;

            #endregion

            return(View(pbsBasicGoodsView));
        }
Пример #4
0
        public ActionResult Order(string Id, string memberId)
        {
            int mid = 0;
            //商品信息
            pbs_basic_GoodsView pbsBasicGoodsView = new pbs_basic_GoodsView();
            int gid = Utility.Util.ParseHelper.ToInt(Id);
            pbs_basic_GoodsService           pbsBasicGoodsService = new pbs_basic_GoodsService();
            ResultInfo <pbs_basic_GoodsView> result = pbsBasicGoodsService.GetGoodsModelViewById(gid);

            if (result.Result && result.Data != null)
            {
                pbsBasicGoodsView     = result.Data;
                ViewData["GoodsView"] = pbsBasicGoodsView;
            }

            //套餐信息
            List <pbs_basic_GoodsPackage> goodsPackageList            = new List <pbs_basic_GoodsPackage>();
            pbs_basic_GoodsPackageService pbsBasicGoodsPackageService = new pbs_basic_GoodsPackageService();
            ResultInfo <List <pbs_basic_GoodsPackage> > resultGoodsPackageViewList = pbsBasicGoodsPackageService.GetAllGoodsPackageListByGoodsTypeId(pbsBasicGoodsView.GoodsTypeId);

            if (resultGoodsPackageViewList.Result && resultGoodsPackageViewList.Data != null)
            {
                goodsPackageList             = resultGoodsPackageViewList.Data;
                ViewData["GoodsPackageList"] = goodsPackageList;
            }

            //用户和成员信息
            pbs_basic_Users              users = new pbs_basic_Users();
            pbs_basic_UsersService       pbsBasicUsersService = new pbs_basic_UsersService();
            ResultInfo <pbs_basic_Users> result_Users         = pbsBasicUsersService.GetUsersModelById(userid);

            if (result_Users.Result && result_Users.Data != null)
            {
                users             = result_Users.Data;
                ViewData["Users"] = users;
            }

            //List<pbs_basic_Members> listMembers = new List<pbs_basic_Members>();
            //pbs_basic_MembersService pbsBasicMembersService = new pbs_basic_MembersService();
            //ResultInfo<List<pbs_basic_Members>> result_Members = pbsBasicMembersService.GetMembersListByUserId(userid);
            //if (result_Members.Result && result_Members.Data != null)
            //{
            //    listMembers = result_Members.Data;
            //    ViewData["Members"] = listMembers;
            //}
            if (!string.IsNullOrWhiteSpace(memberId))
            {
                mid = Utility.Util.ParseHelper.ToInt(memberId);
            }
            pbs_basic_Members              members = new pbs_basic_Members();
            pbs_basic_MembersService       pbsBasicMembersService = new pbs_basic_MembersService();
            ResultInfo <pbs_basic_Members> result_Members         = pbsBasicMembersService.GetMembersModelById(mid);

            if (result_Members.Result && result_Members.Data != null)
            {
                members             = result_Members.Data;
                ViewData["Members"] = members;
            }

            ViewData["MemberId"] = mid;

            return(View());
        }
Пример #5
0
        /// <summary>
        /// 获取传递的支付参数,并绑定页面上
        /// </summary>
        private void BindData(string orderId, string voucherId)
        {
            //pbs_basic_Users userDate = (pbs_basic_Users)Session["Users"];
            //int userid = userDate.UserId;
            //int userid = 5;
            int                      oId                    = Utility.Util.ParseHelper.ToInt(orderId);
            int                      vId                    = Utility.Util.ParseHelper.ToInt(voucherId);
            string                   voucherName            = string.Empty;
            decimal                  voucherPrice           = 0m;
            pbs_basic_GoodsView      pbsBasicGoodsView      = new pbs_basic_GoodsView();
            pbs_basic_Order          order                  = new pbs_basic_Order();
            pbs_basic_Members        members                = new pbs_basic_Members();
            pbs_basic_Voucher        voucher                = new pbs_basic_Voucher();
            pbs_basic_MembersService pbsBasicMembersService = new pbs_basic_MembersService();
            pbs_basic_OrderService   pbsBasicOrderService   = new pbs_basic_OrderService();
            pbs_basic_GoodsService   pbsBasicGoodsService   = new pbs_basic_GoodsService();
            pbs_basic_VoucherService pbsBasicVoucherService = new pbs_basic_VoucherService();

            ResultInfo <pbs_basic_Order> result_order = pbsBasicOrderService.GetOrderModelById(oId);

            if (result_order.Result && result_order.Data != null)
            {
                order = result_order.Data;
                ResultInfo <pbs_basic_GoodsView> result_GoodsView = pbsBasicGoodsService.GetGoodsModelViewById(order.GoodsId);
                if (result_GoodsView.Result && result_GoodsView.Data != null)
                {
                    pbsBasicGoodsView = result_GoodsView.Data;
                }

                ResultInfo <pbs_basic_Members> result_Member = pbsBasicMembersService.GetMembersModelById(Utility.Util.ParseHelper.ToInt(order.OrderMemberId));
                if (result_Member.Result && result_Member.Data != null)
                {
                    members = result_Member.Data;
                }

                if (vId != 0)
                {
                    ResultInfo <pbs_basic_Voucher> result_Voucher = pbsBasicVoucherService.GetVoucherModelById(vId);
                    if (result_Voucher.Result && result_Voucher.Data != null)
                    {
                        voucherPrice = result_Voucher.Data.VoucherPrice;
                        voucherName  = result_Voucher.Data.VoucherPrice.ToString();
                    }

                    //更新订单优惠券
                    ResultInfo <bool> result_UpdateOrderVoucher = pbsBasicOrderService.UpdateOrderVoucher(vId, oId);
                }
            }

            this.OrderSN   = DateTime.Now.ToString("yyyyMMddHHmmss") + "_" + orderId;
            this.MyOrderSN = orderId;
            this.Body      = pbsBasicGoodsView.GoodsName;
            this.TotalFee  = (Convert.ToInt32((pbsBasicGoodsView.SellingPrice - voucherPrice) * 100)).ToString();
            if (Session["UserOpenId"] != null)
            {
                this.UserOpenId = Session["UserOpenId"].ToString();
            }

            GoodsName.Text     = pbsBasicGoodsView.GoodsName;
            VisitTime.Text     = Utility.Util.ParseHelper.ToDatetime(order.VisitTime).ToString("yyyy-MM-dd");
            GoodsTypeName.Text = pbsBasicGoodsView.GoodsTypeName;
            Count.Text         = order.Count.ToString();
            MemberName.Text    = members.MemberName;
            UserName.Text      = order.UserName;
            Phone.Text         = order.Phone;
            SellingPrice.Text  = ((pbsBasicGoodsView.SellingPrice - voucherPrice)).ToString();
            VoucherName.Text   = voucherName;

            this.orderPrice = pbsBasicGoodsView.SellingPrice.ToString();
        }