Beispiel #1
0
        public JsonResult SaveOrder(Model.TD_Donation_Order order)
        {
            order.PayType = Constants.PayType.WeiXin;
            var member = MemberData.GetMember();

            order.MemberID     = member.MemberID;
            order.OpenID       = member.OpenID;
            order.HeaderImage  = member.HeaderImage;
            order.NickName     = member.NickName;
            order.DonationType = (int)Constants.DonationType.RXYS1;
            order.DonationID   = Constants.DonationID.RXYS1;
            order.OrgID        = int.Parse(DESEncrypt.Decrypt(ViewBag.EnOrgID));
            int result = orderBLL.Save(order);

            if (result > 0)
            {
                string url = string.Empty;
                if (order.PayType == Constants.PayType.WeiXin)
                {
                    url = "/WeiXinPay/PayForDonation?oid=" + ViewBag.EnOrgID + "&orderid=" + order.OrderID + "&url=" + HttpUtility.UrlEncode("/Donation/RXYS1/Index?oid=" + ViewBag.EnOrgID);
                }
                return(GetSucceedResult(new
                {
                    url = url
                }, ""));
            }
            else
            {
                return(GetErrorResult("保存失败,请稍候再试"));
            }
        }
Beispiel #2
0
        public JsonResult SaveLeaveMessage(Model.TD_Donation_LeaveMsg model)
        {
            if (string.IsNullOrEmpty(model.Message))
            {
                return(GetErrorResult("请输入留言内容"));
            }
            if (model.Message.Length > 2000)
            {
                return(GetErrorResult("内容不能超过2000字"));
            }
            model.LeaveMsgID = Guid.NewGuid().ToString();
            model.CreateTime = DateTime.Now;
            var member = MemberData.GetMember();

            if (member != null)
            {
                model.HeaderImage = member.HeaderImage;
                model.MemberID    = member.MemberID;
                model.NickName    = member.NickName;
            }
            int result = leaveMsgBLL.Add(model);

            if (result > 0)
            {
                return(GetSucceedResult(new
                {
                }, "保存成功"));
            }
            else
            {
                return(GetErrorResult("保存失败"));
            }
        }
Beispiel #3
0
        public ActionResult Index()
        {
            int orgID  = int.Parse(DESEncrypt.Decrypt(ViewBag.EnOrgID));
            var member = MemberData.GetMember();

            if (member != null)
            {
                ViewBag.NickName    = member.NickName;
                ViewBag.HeaderImage = member.HeaderImage;
            }
            IDictionary <string, object> dict = new Dictionary <string, object>();

            dict.Add("OrgID", orgID);
            dict.Add("DonationID", Constants.DonationID.GDX1);
            StringBuilder where = new StringBuilder();
            where.AppendFormat("OrgID=@OrgID and DonationID=@DonationID and IsPay='1'", orgID, (int)Constants.DonationType.Shop1);
            IList <decimal> counts = orderBLL.GetCount(where.ToString(), dict);

            ViewBag.RecordCount = counts[0];
            ViewBag.TotalMoney  = counts[1];

            string     url  = Request.Url.AbsoluteUri;
            WeiXinPort port = new WeiXinPort();

            port.InitSignature(url);
            ThirdSharedInfo share = port.GetShareInfo(url);

            share.Title       = string.Format("{0}在线功德箱", "净名寺");
            share.Link        = url;
            share.Image       = Request.Url.Scheme + "://" + Request.Url.Authority + "/Content/Org/JMS/logo.jpg";
            share.Content     = "欢迎转发分享,功德无量";
            ViewBag.ShareInfo = share;
            return(View());
        }
Beispiel #4
0
        public JsonResult SaveOrder2(Models.m_Shop_Order model)
        {
            int orgID = int.Parse(DESEncrypt.Decrypt(ViewBag.EnOrgID));

            Model.TD_Shop_Goods goods = goodsBLL.GetModel(model.goodsID);
            if (goods.Balance.Value < model.Amount)
            {
                return(GetErrorResult("数量不足"));
            }
            var member = MemberData.GetMember();

            Model.TD_Shop_Order order = new Model.TD_Shop_Order();
            order.PayType     = Constants.PayType.WeiXin;
            order.MemberID    = member.MemberID;
            order.HeaderImage = member.HeaderImage;
            if (!string.IsNullOrEmpty(model.username) && model.username != "输入姓名")
            {
                order.NickName = model.username;
            }
            else
            {
                order.NickName = member.NickName;
            }
            order.Message   = model.message;
            order.OrderType = (int)Constants.DonationType.Shop1;
            order.OrgID     = orgID;
            order.OriPrice  = goods.Price * model.Amount;
            order.RealPrice = order.OriPrice;
            order.Status    = (int)Constants.OrderStatus.WaitPay;

            IList <Model.TD_Shop_OrderGoods> orderGoodsList = new List <Model.TD_Shop_OrderGoods>();

            Model.TD_Shop_OrderGoods orderGoods = new Model.TD_Shop_OrderGoods();
            orderGoods.GoodsID   = goods.GoodsID;
            orderGoods.Title     = goods.Title;
            orderGoods.Amount    = model.Amount;
            orderGoods.OrgID     = orgID;
            orderGoods.OriPrice  = goods.Price;
            orderGoods.RealPrice = goods.Price;
            orderGoodsList.Add(orderGoods);
            int result = orderBLL.Save(order, orderGoodsList);

            if (result > 0)
            {
                string url = string.Empty;
                if (order.PayType == Constants.PayType.WeiXin)
                {
                    url = "/WeiXinPay/PayForShop?oid=" + ViewBag.EnOrgID + "&orderid=" + order.OrderID + "&url=" + HttpUtility.UrlEncode("/Shop/Goods2/Index?oid=" + ViewBag.EnOrgID);
                }
                return(GetSucceedResult(new
                {
                    url = url
                }, ""));
            }
            else
            {
                return(GetErrorResult("保存失败,请稍候再试"));
            }
        }
Beispiel #5
0
        public ActionResult Index()
        {
            int orgID = int.Parse(DESEncrypt.Decrypt(ViewBag.EnOrgID));

            StringBuilder where = new StringBuilder();
            where.AppendFormat("orders.OrgID={0} and orders.OrderType={1} and orders.IsPay='1'", orgID, (int)Constants.DonationType.Shop1);
            IList <decimal> counts = orderBLL.GetCount(where.ToString());

            ViewBag.RecordCount = counts[0];
            ViewBag.TotalMoney  = counts[1];
            string     url  = Request.Url.AbsoluteUri;
            WeiXinPort port = new WeiXinPort();

            port.InitSignature(url);
            ThirdSharedInfo share = port.GetShareInfo(url);

            share.Title       = string.Format("{0}广种福田", "净名寺");
            share.Link        = url;
            share.Image       = Request.Url.Scheme + "://" + Request.Url.Authority + "/Content/Org/JMS/logo.jpg";
            share.Content     = "欢迎转发分享,功德无量";
            ViewBag.ShareInfo = share;
            var member = MemberData.GetMember();

            if (member != null)
            {
                ViewBag.NickName    = member.NickName;
                ViewBag.HeaderImage = member.HeaderImage;
            }

            //大梁A 9918ac35 - a983 - 40c8 - 822a - 2a71d4866c0f
            var dla = goodsBLL.GetModel("9918ac35-a983-40c8-822a-2a71d4866c0f");

            ViewBag.dla      = dla.Balance + dla.Frozen;
            ViewBag.dlaCount = dla.Amount - dla.Balance - dla.Frozen;
            //大梁B 3a2a9ebe-9900-4ede-966f-23e343c09445
            var dlb = goodsBLL.GetModel("3a2a9ebe-9900-4ede-966f-23e343c09445");

            ViewBag.dlb      = dlb.Balance + dlb.Frozen;
            ViewBag.dlbCount = dlb.Amount - dlb.Balance - dlb.Frozen;
            //副梁A fbc6178f-ba45-4376-b0e1-fe22c36d564b
            var fla = goodsBLL.GetModel("fbc6178f-ba45-4376-b0e1-fe22c36d564b");

            ViewBag.fla      = fla.Balance + fla.Frozen;
            ViewBag.flaCount = fla.Amount - fla.Balance - fla.Frozen;
            //副梁B e49e5b82-83ce-417d-8591-aa216e195099
            var flb = goodsBLL.GetModel("e49e5b82-83ce-417d-8591-aa216e195099");

            ViewBag.flb      = flb.Balance + flb.Frozen;
            ViewBag.flbCount = flb.Amount - flb.Balance - flb.Frozen;
            //佛像 e540dac1-171f-4b75-a852-612de07a9550
            var fx = goodsBLL.GetModel("e540dac1-171f-4b75-a852-612de07a9550");

            ViewBag.fx      = fx.Balance + fx.Frozen;
            ViewBag.fxCount = fx.Amount - fx.Balance - fx.Frozen;

            return(View());
        }
Beispiel #6
0
        public JsonResult SaveOrder(Models.m_YueBing model)
        {
            int orgID = int.Parse(DESEncrypt.Decrypt(ViewBag.EnOrgID));
            var goods = sellBLL.GetModel(model.goodsID);

            if (null == goods)
            {
                throw new Exception("该商品已达上限");
            }
            //if (goods.Balance.Value < model.Amount)
            //{
            //    return GetErrorResult("数量不足");
            //}
            ShiMiao.Model.TD_Shop_Order_Consignee consignee = new Model.TD_Shop_Order_Consignee();
            consignee.Address = model.useraddress;
            consignee.Name    = model.username;
            consignee.Phone   = model.userphone;

            var member = MemberData.GetMember();

            Model.TD_Shop_Order order = new Model.TD_Shop_Order();
            order.PayType     = Constants.PayType.WeiXin;
            order.MemberID    = member.MemberID;
            order.HeaderImage = member.HeaderImage;
            order.NickName    = member.NickName;
            order.OrderType   = (int)Constants.DonationType.Shop1;
            order.OrgID       = orgID;
            //月饼常规价格 + 快递费
            decimal ExtraPrice = 0;

            switch (model.ExtraPrice)
            {
            case 0:    //自提
                ExtraPrice = 0;
                break;

            case 1:    //省内
                ExtraPrice = 6;
                break;

            case 2:    //省外
                ExtraPrice = 8;
                break;

            default:    //其他
                ExtraPrice = 8;
                break;
            }
            order.ExtraPrice = ExtraPrice * model.Amount;
            order.OriPrice   = goods.Price * model.Amount + order.ExtraPrice;
            decimal realPrice = goods.Price.Value;

            if (model.Amount >= 5)
            {//优惠价格 + 快递费
                order.RealPrice = 88 * model.Amount + ExtraPrice * model.Amount;
                realPrice       = 88;
            }
            else
            {
                order.RealPrice = order.OriPrice;
            }
            order.Status = (int)Constants.OrderStatus.WaitPay;

            IList <Model.TD_Shop_OrderGoods> orderGoodsList = new List <Model.TD_Shop_OrderGoods>();

            Model.TD_Shop_OrderGoods orderGoods = new Model.TD_Shop_OrderGoods();
            orderGoods.GoodsID   = goods.GoodsID;
            orderGoods.Title     = goods.Title;
            orderGoods.Amount    = model.Amount;
            orderGoods.OrgID     = orgID;
            orderGoods.OriPrice  = goods.Price;
            orderGoods.RealPrice = realPrice;//goods.Price;
            orderGoodsList.Add(orderGoods);
            int result = orderBLL.Save(order, consignee, orderGoodsList);

            if (result > 0)
            {
                string url = string.Empty;
                if (order.PayType == Constants.PayType.WeiXin)
                {
                    url = "/WeiXinPay/PayForShop?oid=" + ViewBag.EnOrgID + "&orderid=" + order.OrderID + "&url=" + HttpUtility.UrlEncode("/Shop/YueBing/Index?oid=" + ViewBag.EnOrgID);
                }
                return(GetSucceedResult(new
                {
                    url = url
                }, ""));
            }
            else
            {
                return(GetErrorResult("保存失败,请稍候再试"));
            }
        }
        public ActionResult PayForShop(string orderid, string url)
        {
            var member = MemberData.GetMember();
            var now    = DateTime.Now;

            if (string.IsNullOrEmpty(orderid))
            {
                return(GotoErrorResult("未找到该订单"));
            }
            Model.TD_Shop_Order model = shopOrderBLL.GetModel(orderid);
            if (model == null)
            {
                return(GotoErrorResult("未找到该订单"));
            }
            if (model.Status == (int)Constants.OrderStatus.Cancel)
            {
                return(GotoErrorResult("订单已取消"));
            }
            if (model.IsPay == "0")
            {
                bool exists = weiXinPayBLL.OrderIsPay(model.OrderID, 1);
                if (exists)
                {
                    return(GotoErrorResult("订单已微信支付,请联系平台"));
                }
                string     ip   = Request.UserHostAddress;
                WeiXinPort port = new WeiXinPort();
                try
                {
                    port.InitSignature(HttpContext.Request.Url.AbsoluteUri);
                    string domain = Request.Url.Scheme + "://" + Request.Url.Authority;
                    port.InitPaySignature(model.OrderID.ToString(), model.RealPrice.Value, member.OpenID, domain, ip);
                    if (!string.IsNullOrEmpty(port.ErrorMessage))
                    {
                        return(GotoErrorResult(port.ErrorMessage));
                    }
                    Model.TD_Order_WeiXinPay weiXinPay = new Model.TD_Order_WeiXinPay();
                    weiXinPay.OrderID   = model.OrderID.ToString();
                    weiXinPay.Timestamp = port.Timestamp;
                    weiXinPay.NonceStr  = port.NonceStr;
                    weiXinPay.Package   = port.Package;
                    weiXinPay.Status    = 0;
                    weiXinPay.PayTime   = now;
                    weiXinPayBLL.Add(weiXinPay);
                    ViewBag.ThirdPortConfig = new ThirdSharedInfo()
                    {
                        AppID        = port.AppID,
                        NonceStr     = port.NonceStr,
                        Timestamp    = port.Timestamp,
                        Package      = port.Package,
                        SignType     = port.SignType,
                        Signature    = port.Signature,
                        PaySignature = port.PaySignature
                    };
                }
                catch
                { }
                ViewBag.BackURL = HttpUtility.UrlEncode(url);
                return(View(model));
            }
            else
            {
                return(GotoErrorResult("订单状态有误"));
            }
        }
Beispiel #8
0
        public JsonResult SaveOrder(Models.m_YueBing model)
        {
            int orgID = int.Parse(DESEncrypt.Decrypt(ViewBag.EnOrgID));

            Model.TD_Shop_Goods goods = goodsBLL.GetModel(model.goodsID);
            if (goods.Balance.Value < model.Amount)
            {
                return(GetErrorResult("数量不足"));
            }
            ShiMiao.Model.TD_Shop_Order_Consignee consignee = new Model.TD_Shop_Order_Consignee();
            consignee.Address        = model.Adress;
            consignee.Name           = model.username;
            consignee.Phone          = model.Phone;
            consignee.Identification = model.Identification;

            var member = MemberData.GetMember();

            Model.TD_Shop_Order order = new Model.TD_Shop_Order();
            order.PayType     = Constants.PayType.WeiXin;
            order.MemberID    = member.MemberID;
            order.HeaderImage = member.HeaderImage;
            order.NickName    = member.NickName;
            order.OrderType   = (int)Constants.DonationType.Shop1;
            order.OrgID       = orgID;
            //月饼常规价格 + 快递费
            order.OriPrice = goods.Price * model.Amount + model.ExtraPrice * model.Amount;
            if (model.Amount >= 5)
            {//优惠价格 + 快递费
                order.RealPrice = 88 * model.Amount + model.ExtraPrice * model.Amount;
            }
            else
            {
                order.RealPrice = order.OriPrice;
            }
            order.Status = (int)Constants.OrderStatus.WaitPay;

            IList <Model.TD_Shop_OrderGoods> orderGoodsList = new List <Model.TD_Shop_OrderGoods>();

            Model.TD_Shop_OrderGoods orderGoods = new Model.TD_Shop_OrderGoods();
            orderGoods.GoodsID   = goods.GoodsID;
            orderGoods.Title     = goods.Title;
            orderGoods.Amount    = model.Amount;
            orderGoods.OrgID     = orgID;
            orderGoods.OriPrice  = goods.Price;
            orderGoods.RealPrice = goods.Price;
            orderGoodsList.Add(orderGoods);
            int result = orderBLL.Save(order, orderGoodsList);

            if (result > 0)
            {
                string url = string.Empty;
                if (order.PayType == Constants.PayType.WeiXin)
                {
                    url = "/WeiXinPay/PayForShop?oid=" + ViewBag.EnOrgID + "&orderid=" + order.OrderID + "&url=" + HttpUtility.UrlEncode("/Shop/Goods2/Index?oid=" + ViewBag.EnOrgID);
                }
                return(GetSucceedResult(new
                {
                    url = url
                }, ""));
            }
            else
            {
                return(GetErrorResult("保存失败,请稍候再试"));
            }
        }