示例#1
0
        /// <summary>
        /// 取得当前微信帐号信息
        /// </summary>
        public Model.wx_userweixin GetWeiXinCode()
        {
            if (IsWeiXinCode())
            {
                Model.wx_userweixin model = Session["nowweixin"] as Model.wx_userweixin;
                if (model != null)
                {
                    return(model);
                }
            }
            else
            {
                int shopid = GetShopId();
                if (shopid != 0)
                {
                    BLL.wx_diancai_shopinfo   shopBll = new BLL.wx_diancai_shopinfo();
                    Model.wx_diancai_shopinfo shop    = shopBll.GetModel(shopid);

                    return(new BLL.wx_userweixin().GetModel(shop.wid.Value));
                }

                int hotelid = GetHotelId();
                if (hotelid != 0)
                {
                    BLL.wx_hotels_info   hotelBll = new BLL.wx_hotels_info();
                    Model.wx_hotels_info hotel    = hotelBll.GetModel(hotelid);

                    return(new BLL.wx_userweixin().GetModel(hotel.wid.Value));
                }
                Response.Write("<script>parent.location.href='http://" + HttpContext.Current.Request.Url.Authority + "/admin/weixin/myweixinlist.aspx'</script>");
                Response.End();
            }
            return(null);
        }
示例#2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                shopid     = MyCommFun.RequestInt("shopid");
                openid     = MyCommFun.QueryString("openid");
                dingdan    = MyCommFun.RequestInt("dingdan");
                wid        = MyCommFun.RequestInt("wid");
                refundCode = MyCommFun.QueryString("RefundCode");

                var shopinfo = new BLL.wx_diancai_shopinfo().GetModel(shopid);
                RestruantName     = shopinfo.hotelName;
                RestruantLocation = shopinfo.address;
                rename            = shopinfo.dcRename;

                if (dingdan > 0)
                {
                    if (shopinfo.xplace != null)
                    {
                        lat = Convert.ToDouble(shopinfo.xplace.Value);
                    }
                    if (shopinfo.yplace != null)
                    {
                        lng = Convert.ToDouble(shopinfo.yplace.Value);
                    }

                    BindOrderDetaile();
                }
            }
        }
示例#3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                BLL.wx_diancai_shopinfo shopBll = new BLL.wx_diancai_shopinfo();

                shopid    = MyCommFun.RequestInt("shopid");
                openid    = MyCommFun.QueryString("openid");
                shopinfo  = shopBll.GetModel(shopid);
                hotelName = shopinfo.hotelName;
                rename    = shopinfo.dcRename;

                BLL.wx_diancai_member           menberbll = new BLL.wx_diancai_member();
                IList <Model.wx_diancai_member> memlist   = menberbll.GetModelList("shopid=" + shopid + " and openid='" + openid + "'");

                if (memlist == null || memlist.Count <= 0 || memlist[0] == null)
                {
                }
                else
                {
                    username = memlist[0].Name;
                    usertel  = memlist[0].menberTel;
                    useraddr = memlist[0].memberAddress;
                }
            }
        }
示例#4
0
        /// <summary>
        /// 获取周边美食
        /// </summary>
        /// <param name="wid"></param>
        /// <param name="keywords"></param>
        /// <param name="recommend"></param>
        /// <returns></returns>
        public List <POIDto> GetCateringShops(int wid, string keywords, bool recommend = false)
        {
            BLL.wx_diancai_shopinfo bll = new BLL.wx_diancai_shopinfo();

            string strWhere = string.Format("wid={0}", wid);

            if (!string.IsNullOrEmpty(keywords))
            {
                strWhere += string.Format("  And hotelName Like '%{0}%'", keywords);
            }

            if (recommend)
            {
                strWhere += " And Recommend=1";
            }

            var shops = bll.GetModelList(strWhere);

            if (shops.Any())
            {
                return(shops.Select(s => new POIDto
                {
                    Id = s.id,
                    Name = s.hotelName,
                    Introduction = s.hotelintroduction,
                    Logo = s.hotelLogo,
                    Lat = (double)(s.xplace.HasValue ? s.xplace.Value : 0),
                    Lng = (double)(s.yplace.HasValue ? s.yplace.Value : 0),
                    PoiType = "catering"
                }).ToList());
            }

            return(null);
        }
示例#5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //OAuth2
            string thisUrl = MyCommFun.getWebSite() + "/weixin/restaurant/index.aspx" + Request.Url.Query;
            var    bll     = new BLL.wx_userweixin();
            int    widInt  = MyCommFun.RequestWid();

            Model.wx_userweixin uWeiXinModel = bll.GetModel(widInt);
            OAuth2BaseProc(uWeiXinModel, "index", thisUrl);


            this.shopid = string.IsNullOrEmpty(WebHelper.GetQueryString("shopid")) ? 0 : int.Parse(WebHelper.GetQueryString("shopid"));
            this.openid = string.IsNullOrEmpty(WebHelper.GetQueryString("openid")) ? "loseopenid" : WebHelper.GetQueryString("openid");
            this.wid    = string.IsNullOrEmpty(WebHelper.GetQueryString("wid")) ? "1" : WebHelper.GetQueryString("wid");
            this.title  = this.GetTitle();

            if (!Page.IsPostBack)
            {
                if (this.shopid == 0)
                {
                    this.hotelName = "无选定商铺";
                }
                else
                {
                    var shopinfo = new BLL.wx_diancai_shopinfo().GetModel(this.shopid);

                    if (shopinfo == null)
                    {
                        return;
                    }
                    this.hotelName = shopinfo.hotelName;
                }
            }
        }
示例#6
0
        private void RptBind(string _strWhere, string _orderby)
        {
            Model.wx_userweixin weixin = GetWeiXinCode();

            //判断是否已经设置了微留言基本信息
            BLL.wx_diancai_shopinfo sbll = new BLL.wx_diancai_shopinfo();


            _strWhere        = "wid=" + weixin.id + " " + _strWhere;
            this.page        = MXRequest.GetQueryInt("page", 1);
            txtKeywords.Text = this.keywords;
            DataSet ds = gbll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount);

            // DataSet ds = gbll.GetList( _strWhere);
            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                DataRow dr;

                int count = ds.Tables[0].Rows.Count;
                for (int i = 0; i < count; i++)
                {
                    dr = ds.Tables[0].Rows[i];
                }
                ds.AcceptChanges();
            }
            this.rptList.DataSource = ds;
            this.rptList.DataBind();

            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("shop_list.aspx", "keywords={0}&page={1}", this.keywords, "__id__");

            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
示例#7
0
        public MapDTO GetShop(int id)
        {
            MapDTO result = null;

            var hotel = new BLL.wx_diancai_shopinfo().GetModel(id);

            result = Mapper.Map <Model.wx_diancai_shopinfo, MapDTO>(hotel);

            return(result);
        }
示例#8
0
        protected void BindFormControl()
        {
            BLL.wx_diancai_caipin_category categorybll = new BLL.wx_diancai_caipin_category();
            BLL.wx_diancai_member          menberbll   = new BLL.wx_diancai_member();
            Model.wx_diancai_member        member      = new Model.wx_diancai_member();

            BLL.wx_diancai_shopinfo   shopBll  = new BLL.wx_diancai_shopinfo();
            Model.wx_diancai_shopinfo shopinfo = new Model.wx_diancai_shopinfo();

            openid = MyCommFun.QueryString("openid");
            shopid = MyCommFun.RequestInt("shopid");
            wid    = MyCommFun.QueryString("wid");

            if (openid == "" || shopid == 0)
            {
                return;
            }

            shopinfo = shopBll.GetModel(shopid);

            if (shopinfo == null)
            {
                return;
            }

            hotelName = shopinfo.hotelName;
            idf       = MyCommFun.RequestInt("id");

            member = menberbll.GetModel(shopid, openid);
            if (member != null)
            {
                name  = member.memberName;
                phone = member.menberTel;
            }

            categories = "{";

            DataSet category1 = categorybll.GetList(shopid);

            if (category1.Tables[0].Rows.Count > 0)
            {
                for (int i = 0; i < category1.Tables[0].Rows.Count; i++)
                {
                    categories += "\"" + category1.Tables[0].Rows[i]["id"].ToString() + "\"" + ":" + "\"" + category1.Tables[0].Rows[i]["categoryName"].ToString() + "\"" + ",";
                }
            }
            categories  = categories.Substring(0, categories.Length - 1);
            categories += "}";
        }
        private void RptBind(string _strWhere, string _orderby)
        {

            Model.wx_userweixin weixin = GetWeiXinCode();

            //判断是否已经设置了微留言基本信息
            BLL.wx_diancai_shopinfo sbll = new BLL.wx_diancai_shopinfo();
      

            _strWhere = "wid=" + weixin.id + " " + _strWhere;
            this.page = MXRequest.GetQueryInt("page", 1);
            txtKeywords.Text = this.keywords;
            DataSet ds = gbll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount);
            // DataSet ds = gbll.GetList( _strWhere);
            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                DataRow dr;

                int count = ds.Tables[0].Rows.Count;
                for (int i = 0; i < count; i++)
                {
                    dr = ds.Tables[0].Rows[i];

                }
                ds.AcceptChanges();
            }
            this.rptList.DataSource = ds;
            this.rptList.DataBind();

            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("shop_list.aspx", "keywords={0}&page={1}", this.keywords, "__id__");
            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);


        }
示例#10
0
        public void ProcessRequest(HttpContext context)
        {
            Dictionary <string, string> jsonDict = new Dictionary <string, string>();

            context.Response.ContentType = "text/json";
            string _action   = MyCommFun.QueryString("myact");
            string username  = MyCommFun.QueryString("username");
            string parssword = MyCommFun.QueryString("parssword");
            string id        = MyCommFun.QueryString("id");
            string openid    = MyCommFun.QueryString("openid");
            string state     = MyCommFun.QueryString("state");
            string goodsData = QueryString("goodsData");
            int    shopid    = MyCommFun.RequestInt("shopid");


            BLL.wx_diancai_dianyuan   dianyuanbll = new BLL.wx_diancai_dianyuan();
            Model.wx_diancai_dianyuan dianyuan    = new Model.wx_diancai_dianyuan();


            BLL.wx_diancai_caipin_category categorybll = new BLL.wx_diancai_caipin_category();

            BLL.wx_diancai_member   menberbll = new BLL.wx_diancai_member();
            Model.wx_diancai_member member    = new Model.wx_diancai_member();

            BLL.wx_diancai_dingdan_manage    manage      = new BLL.wx_diancai_dingdan_manage();
            Model.wx_diancai_dingdan_manage  managemodel = new Model.wx_diancai_dingdan_manage();
            BLL.wx_diancai_dingdan_caiping   caipinbll   = new BLL.wx_diancai_dingdan_caiping();
            Model.wx_diancai_dingdan_caiping caipin      = new Model.wx_diancai_dingdan_caiping();

            if (_action == "login")
            {
                if (dianyuanbll.Exists(username, parssword))
                {
                    jsonDict.Add("ret", "ok");
                    jsonDict.Add("content", "登录成功!");

                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                }
                else
                {
                    jsonDict.Add("ret", "fail");
                    jsonDict.Add("content", "密码错误!");

                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                }
            }

            else if (_action == "setstatus")
            {
                //id

                if (manage.Updatestatus(id, state))
                {
                    managemodel = manage.GetModel(MyCommFun.Str2Int(id));
                    BLL.wx_diancai_member menbll = new BLL.wx_diancai_member();
                    if (state == "1")
                    {
                        menbll.Update(managemodel.openid);
                    }
                    if (state == "2")
                    {
                        menbll.Updatefail(managemodel.openid);
                    }

                    jsonDict.Add("ret", "ok");
                    jsonDict.Add("content", "提交成功!");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                }
            }

            else if (_action == "addmember")
            {
                #region 用户基本信息管理
                member = menberbll.GetModel(shopid, openid);
                bool isAdd = false;
                if (member == null)
                {
                    isAdd = true;
                }
                else
                {
                    if (member.status.Value == 0)
                    {
                        //处于黑名单里
                        jsonDict.Add("ret", "fail");
                        jsonDict.Add("content", "您处于黑名单里!");
                        context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                        return;
                    }
                }


                member.shopid         = shopid;
                member.openid         = openid;
                member.weixinName     = MyCommFun.QueryString("weixinName");
                member.Name           = MyCommFun.QueryString("username");
                member.memberName     = MyCommFun.QueryString("username");
                member.menberTel      = MyCommFun.QueryString("customerTel");
                member.memberAddress  = MyCommFun.QueryString("address");
                member.successDingdan = 0;
                member.failDingdan    = 0;
                member.cancelDingdan  = 0;
                member.zongjifen      = 0;
                member.zongcje        = 0;
                member.status         = 0;
                member.createDate     = DateTime.Now;

                if (isAdd)
                {
                    menberbll.Add(member);
                }
                else
                {
                    menberbll.Update(member);
                }

                jsonDict.Add("ret", "ok");
                jsonDict.Add("content", "提交成功!");
                context.Response.Write(MyCommFun.getJsonStr(jsonDict));


                #endregion
            }
            else if (_action == "addcaidan")
            {
                string deskNumber = MyCommFun.QueryString("deskNumber");//桌号
                //用户点菜完,提交订单
                #region 判断参数是否合法,判断用户是否处于黑名单里
                if (goodsData == "" || openid == "")
                {
                    jsonDict.Add("ret", "err");
                    jsonDict.Add("content", "订单提交失败,参数为空值!");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    return;
                }

                member = menberbll.GetModel(shopid, openid);
                bool isAdd = false;
                if (member == null)
                {
                    isAdd  = true;
                    member = new Model.wx_diancai_member();
                }
                else
                {
                    if (member.status.Value == 0)
                    {
                        //处于黑名单里
                        jsonDict.Add("ret", "fail");
                        jsonDict.Add("content", "您处于黑名单里,不能下单!");
                        context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                        return;
                    }
                }

                #endregion

                //获得商家信息
                BLL.wx_diancai_shopinfo   shopbll        = new BLL.wx_diancai_shopinfo();
                Model.wx_diancai_shopinfo shopinfoEntity = new Model.wx_diancai_shopinfo();
                shopinfoEntity = shopbll.GetModel(shopid);

                #region 计算商品总价格
                decimal  payAmount = 0;
                string[] sArray    = goodsData.Split(';');

                for (int i = 0; i < sArray.Length - 1; i++)
                {
                    string[] sAr = sArray[i].Split(',');
                    payAmount += Convert.ToInt32(sAr[1]) * Convert.ToDecimal(sAr[2]);//总价
                }

                #endregion


                member.shopid = shopid;
                member.openid = openid;

                member.Name           = MyCommFun.QueryString("name");
                member.memberName     = MyCommFun.QueryString("name");
                member.menberTel      = MyCommFun.QueryString("phone");
                member.memberAddress  = MyCommFun.QueryString("address");
                member.successDingdan = 0;
                member.failDingdan    = 0;
                member.cancelDingdan  = 0;
                member.zongjifen      = 0;
                member.zongcje        = 0;
                member.status         = 0;
                member.createDate     = DateTime.Now;

                if (isAdd)
                {
                    menberbll.Add(member);
                }
                else
                {
                    menberbll.Update(member);
                }

                #region //订单信息
                managemodel.shopinfoid   = shopid;
                managemodel.openid       = openid;
                managemodel.orderNumber  = Utils.Number(13); //订单号
                managemodel.deskNumber   = deskNumber;       //桌号deskNumber
                managemodel.customerName = MyCommFun.QueryString("name");
                managemodel.customerTel  = MyCommFun.QueryString("phone");
                managemodel.address      = MyCommFun.QueryString("address");
                managemodel.oderRemark   = MyCommFun.QueryString("oderRemark");
                managemodel.payStatus    = 0;
                managemodel.oderRemark   = "";
                managemodel.oderTime     = DateTime.Now;
                managemodel.createDate   = DateTime.Now;
                int idf = manage.Add(managemodel);

                #endregion

                #region   //form表单提交
                BLL.wx_diancai_form_control           cBll        = new BLL.wx_diancai_form_control();
                IList <Model.wx_diancai_form_control> controlList = cBll.GetModelList("shopinfoId=" + shopid);
                if (controlList != null)
                {
                    BLL.wx_diancai_form_result   retBll = new BLL.wx_diancai_form_result();
                    Model.wx_diancai_form_result result = new Model.wx_diancai_form_result();
                    result.shopinfoId = shopid;
                    result.openid     = openid;
                    result.createDate = DateTime.Now;

                    Model.wx_diancai_form_control control = new Model.wx_diancai_form_control();
                    for (int i = 0; i < controlList.Count; i++)
                    {
                        control = controlList[i];
                        string reqControlIdValue = MyCommFun.QueryString("control_" + control.seq);
                        result.cId        = control.seq;
                        result.cName      = control.cName;
                        result.userResult = reqControlIdValue;
                        retBll.Add(result);
                    }
                }
                #endregion

                //菜品

                for (int i = 0; i < sArray.Length - 1; i++)
                {
                    string[] sAr = sArray[i].Split(',');
                    caipin.dingId  = idf;
                    caipin.caiId   = Convert.ToInt32(sAr[0]);                             //菜品ID
                    caipin.num     = Convert.ToInt32(sAr[1]);                             //菜品件数
                    caipin.price   = Convert.ToDecimal(sAr[2]);                           //菜品单价
                    caipin.totpric = Convert.ToInt32(sAr[1]) * Convert.ToDecimal(sAr[2]); //总价
                    //  payAmount += Convert.ToInt32(sAr[1]) * Convert.ToDecimal(sAr[2]);//客户购买总价
                    caipinbll.Add(caipin);
                }
                //订单满多少免配送费
                if (payAmount < shopinfoEntity.freeSendcost)
                {
                    payAmount += Convert.ToDecimal(shopinfoEntity.sendCost);
                }

                bool isOk = manage.Update(idf, payAmount);
                if (isOk)
                {
                    jsonDict.Add("ret", "ok");
                    jsonDict.Add("content", "订单提交成功!请到订单查看!");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                }
                else
                {
                    jsonDict.Add("ret", "err");
                    jsonDict.Add("content", "订单提交失败!");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                }
                context.Response.End();
            }
        }
示例#11
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/json";
            string _action   = MyCommFun.QueryString("myact");
            string username  = MyCommFun.QueryString("username");
            string parssword = MyCommFun.QueryString("parssword");
            string id        = MyCommFun.QueryString("id");

            openid = MyCommFun.QueryString("openid");
            string state = MyCommFun.QueryString("state");

            goodsData = QueryString("goodsData");
            shopid    = MyCommFun.RequestInt("shopid");


            BLL.wx_diancai_dianyuan         dianyuanbll = new BLL.wx_diancai_dianyuan();
            BLL.wx_diancai_dingdan_manage   manage      = new BLL.wx_diancai_dingdan_manage();
            Model.wx_diancai_dingdan_manage managemodel = new Model.wx_diancai_dingdan_manage();


            if (_action == "login")
            {
                if (dianyuanbll.Exists(username, parssword))
                {
                    jsonDict.Add("ret", "ok");
                    jsonDict.Add("content", "登录成功!");

                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                }
                else
                {
                    jsonDict.Add("ret", "fail");
                    jsonDict.Add("content", "密码错误!");

                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                }
            }

            else if (_action == "setstatus")
            {
                //id

                if (manage.Updatestatus(id, state))
                {
                    managemodel = manage.GetModel(MyCommFun.Str2Int(id));
                    BLL.wx_diancai_member menbll = new BLL.wx_diancai_member();
                    if (state == "1")
                    {
                        menbll.Update(managemodel.openid);
                    }
                    if (state == "2")
                    {
                        menbll.Updatefail(managemodel.openid);
                    }

                    jsonDict.Add("ret", "ok");
                    jsonDict.Add("content", "提交成功!");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                }
            }
            else if (_action == "addcaidan")
            {
                var orderProcessResult = this.ProcessOrder();

                if (!orderProcessResult.IsSuccess)
                {
                    this.jsonDict.Add("ret", "err");
                    this.jsonDict.Add("content", orderProcessResult.Message);
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    return;
                }

                var order = orderProcessResult.BusinessData as Model.wx_diancai_dingdan_manage;

                if (order != null)
                {
                    //this.jsonDict.Add("ret", "ok");
                    //this.jsonDict.Add("content", orderProcessResult.Message);
                    //this.jsonDict.Add("orderid", order.id.ToString());
                    //this.jsonDict.Add("ordercode", order.orderNumber);
                    //this.jsonDict.Add("openid", openid);
                    //this.jsonDict.Add("payamount", order.payAmount.ToString());
                    //this.jsonDict.Add("shopname", new BLL.wx_diancai_shopinfo().GetModel(this.shopid).hotelName);
                    //this.jsonDict.Add("wid", order.wid.ToString());
                    //this.jsonDict.Add("orderNumber", order.orderNumber);
                    //context.Response.Write(MyCommFun.getJsonStr(this.jsonDict));

                    var shopInfo = new BLL.wx_diancai_shopinfo().GetModel(this.shopid);
                    var entity   = new UnifiedOrderEntity
                    {
                        OrderId      = order.id.ToString(),
                        wid          = order.wid,
                        total_fee    = order.payAmount == null ? 0 : (int)order.payAmount,
                        out_trade_no = order.orderNumber,
                        openid       = openid,
                        body         = string.Format("订单编号{0} {1}", order.orderNumber, shopInfo.hotelName),
                        PayModuleID  = (int)PayModuleEnum.Restaurant,
                        PayComplete  = "../restaurant/AfterPay.aspx"
                    };

                    entity.Extra.Add("content", orderProcessResult.Message);
                    entity.Extra.Add("shopname", new BLL.wx_diancai_shopinfo().GetModel(this.shopid).hotelName);
                    entity.Extra.Add("shopid", shopid.ToString());
                    entity.Extra.Add("wid", shopInfo.wid.ToString());

                    var ticket  = EncryptionManager.CreateIV();
                    var payData = EncryptionManager.AESEncrypt(entity.ToJson(), ticket);

                    context.Response.Write(AjaxResult.Success(PayHelper.GetPayUrl(payData, ticket)));
                }

                context.Response.End();
            }
            else if (_action == "productDetail")
            {
                var productId = MyCommFun.QueryString("productId");


                if (!string.IsNullOrEmpty(productId))
                {
                    var    model    = new BLL.wx_diancai_caipin_manage().GetModel(int.Parse(productId));
                    String useRange = string.Empty;
                    if (model.beginDate.HasValue || model.endDate.HasValue)
                    {
                        useRange = string.Format("{0}至{1}",
                                                 model.beginDate.HasValue ? model.beginDate.Value.ToString("yyyy-MM-dd") : string.Empty,
                                                 model.endDate.HasValue ? model.endDate.Value.ToString("yyyy-MM-dd") : string.Empty);
                    }
                    var data = new
                    {
                        shopIntroduction = model.shopIntroduction,
                        detailContent    = model.detailContent,
                        instructions     = model.instructions,
                        chargeback       = model.chargeback,
                        useRange         = useRange
                    };
                    context.Response.Write(AjaxResult.Success(data).ToCamelString());
                }

                context.Response.End();
            }
            else if (_action == "caipinDetail")
            {
                var caipinId    = MyCommFun.RequestInt("caipinId");
                var caipinModel = new BLL.wx_diancai_caipin_manage().GetModel(caipinId);

                String useRange = string.Empty;
                if (caipinModel.beginDate.HasValue || caipinModel.endDate.HasValue)
                {
                    useRange = string.Format("{0}至{1}",
                                             caipinModel.beginDate.HasValue ? caipinModel.beginDate.Value.ToString("yyyy-MM-dd") : string.Empty,
                                             caipinModel.endDate.HasValue ? caipinModel.endDate.Value.ToString("yyyy-MM-dd") : string.Empty);
                }

                String jianjie    = caipinModel.shopIntroduction;
                String tuidanRule = caipinModel.chargeback;
                string pictureUrl = caipinModel.picUrl;

                var result = new
                {
                    Name             = caipinModel.cpName,
                    Url              = MapUrl(pictureUrl),
                    Range            = useRange,
                    Intruduce        = jianjie,
                    Rule             = tuidanRule,
                    suoming          = caipinModel.detailContent,
                    shopIntroduction = caipinModel.shopIntroduction
                };

                context.Response.Write(AjaxResult.Success(result));
                context.Response.End();
            }
        }
示例#12
0
        protected void btnAgreeRefund_Click(object sender, EventArgs e)
        {
            try
            {
                var refundBll    = new BLL.wx_diancai_tuidan_manage();
                var refundResult = refundBll.GetWeChatRefundParams(shopid, orderID, refundCode);

                //使用系统订单号退单
                if (refundResult != null && refundResult.Tables.Count > 0 && refundResult.Tables[0].Rows.Count > 0)
                {
                    var orderNumber    = refundResult.Tables[0].Rows[0]["orderNumber"].ToString();
                    var transaction_id = refundResult.Tables[0].Rows[0]["transaction_id"].ToString();
                    var refundAmount   = Convert.ToInt32(refundResult.Tables[0].Rows[0]["refundAmount"]);
                    var payAmount      = Convert.ToInt32(refundResult.Tables[0].Rows[0]["payAmount"]);

                    var shopInfo = new BLL.wx_diancai_shopinfo().GetModel(shopid);
                    var wxModel  = new BLL.wx_userweixin().GetModel((int)shopInfo.wid);
                    var payInfo  = new BLL.wx_payment_wxpay().GetModelByWid((int)shopInfo.wid);

                    var requestHandler = new RequestHandler(null);
                    requestHandler.SetParameter("out_trade_no", orderNumber);
                    //requestHandler.SetParameter("transaction_id", transaction_id);
                    requestHandler.SetParameter("out_refund_no", refundCode);
                    requestHandler.SetParameter("appid", wxModel.AppId);
                    requestHandler.SetParameter("mch_id", payInfo.mch_id);//商户号
                    requestHandler.SetParameter("nonce_str", Guid.NewGuid().ToString().Replace("-", ""));

                    //退款金额
                    if (PayHelper.IsDebug)
                    {
                        requestHandler.SetParameter("total_fee", (payAmount / 100).ToString());
                        requestHandler.SetParameter("refund_fee", (refundAmount / 100).ToString());
                    }
                    else
                    {
                        requestHandler.SetParameter("total_fee", payAmount.ToString());
                        requestHandler.SetParameter("refund_fee", refundAmount.ToString());
                    }

                    requestHandler.SetParameter("op_user_id", wxModel.AppId);
                    requestHandler.SetParameter("sign", requestHandler.CreateMd5Sign("key", payInfo.paykey));

                    var refundInfo          = TenPayV3Helper.Refund(requestHandler.ParseXML(), string.Format(@"{0}{1}", AppDomain.CurrentDomain.BaseDirectory, payInfo.certInfoPath), payInfo.cerInfoPwd);
                    var refundOrderResponse = new RefundOrderResponse(refundInfo);
                    if (refundOrderResponse.IsSuccess)
                    {
                        new BLL.wx_diancai_tuidan_manage().RefundComplete(refundCode, this.txtRefundReason.Value.Trim());
                        Response.Redirect("diancai_dingdanRefund_manage.aspx");
                    }
                    else
                    {
                        Response.Write(refundOrderResponse.return_msg);
                        List();
                    }
                }
            }
            catch (Exception exception)
            {
                Response.Write(exception.Message);
                Response.Write(exception.StackTrace);
                List();
            }
        }
示例#13
0
        protected void BindFormControl()
        {
            BLL.wx_diancai_caipin_category categorybll = new BLL.wx_diancai_caipin_category();

            BLL.wx_diancai_dingdan_caiping caipinbll = new BLL.wx_diancai_dingdan_caiping();

            BLL.wx_diancai_member   menberbll = new BLL.wx_diancai_member();
            Model.wx_diancai_member member    = new Model.wx_diancai_member();

            BLL.wx_diancai_shopinfo   shopBll  = new BLL.wx_diancai_shopinfo();
            Model.wx_diancai_shopinfo shopinfo = new Model.wx_diancai_shopinfo();

            BLL.wx_diancai_form_control controlbll = new BLL.wx_diancai_form_control();



            openid = MyCommFun.QueryString("openid");

            shopid = MyCommFun.RequestInt("shopid");

            zhuohao(shopid);

            if (openid == "" || shopid == 0)
            {
                return;
            }


            shopinfo  = shopBll.GetModel(shopid);
            rename    = shopinfo.dcRename;
            hotelName = shopinfo.hotelName;
            idf       = MyCommFun.RequestInt("id");

            member = menberbll.GetModel(shopid, openid);
            if (member != null)
            {
                name  = member.memberName;
                phone = member.menberTel;
                this.address.InnerText = member.memberAddress;
            }

            if (shopinfo.limiteOrder && (!isOpen(shopinfo)))
            {
                contact_info.Style.Add("display", "none");
                showcard.Style.Add("display", "none");
                // MessageBox.ResponseScript(this, "$(\"#showcard2\").show();");
                showcard2.Style.Add("display", "");
                // contact_info.InnerHtml = "";
            }

            //获取控件
            DataSet ZH = controlbll.GetListZH(shopid);

            if (ZH.Tables[0].Rows.Count > 0)
            {
                for (int i = 0; i < ZH.Tables[0].Rows.Count; i++)
                {
                    if (ZH.Tables[0].Rows[i]["cType"].ToString() == "0")
                    {
                        kongjian += "<tr><td width=\"80px\"><label for=\"txt" + i + "\" class=\"ui-input-text\"  >" + ZH.Tables[0].Rows[i]["cName"] + ":</label></td>";
                        kongjian += "<td><div class=\"ui-input-text\">";
                        kongjian += " <input type=\"text\" id=\"txt" + i + "\" name=\"txt" + i + "\"  value=\"\"   class=\"ui-input-text\" placeholder=\"" + ZH.Tables[0].Rows[i]["defaultValue"] + "\">";
                        kongjian += "</div></td></tr>";

                        javascriptStr += "control_" + ZH.Tables[0].Rows[i]["seq"] + ":$(\"#txt" + i + "\").val(),";
                    }
                    else if (ZH.Tables[0].Rows[i]["cType"].ToString() == "1")
                    {
                        kongjian += "<tr><td width=\"80px\"><label for=\"select" + i + "\"  class=\"ui-input-text\"  >" + ZH.Tables[0].Rows[i]["cName"] + ":</label></td>";
                        kongjian += "<td>";
                        kongjian += "<select name=\"select" + i + "\" class=\"selectstyle\" id=\"select" + i + "\"  >";
                        if (ZH.Tables[0].Rows[i]["defaultValue"].ToString() != "")
                        {
                            string   strzh  = ZH.Tables[0].Rows[i]["defaultValue"].ToString().Replace(",", ",");
                            string[] sArray = strzh.Split(',');
                            for (int j = 0; j < sArray.Length; j++)
                            {
                                kongjian += "<option   value=" + sArray[j] + ">" + sArray[j] + "</option>";
                            }
                        }
                        kongjian += "</select>";
                        kongjian += "</td></tr>";

                        javascriptStr += "control_" + ZH.Tables[0].Rows[i]["seq"] + ":$(\"#select" + i + "\").val(),";
                    }
                }
            }

            categories = "{";

            DataSet category1 = categorybll.GetList(shopid);

            if (category1.Tables[0].Rows.Count > 0)
            {
                for (int i = 0; i < category1.Tables[0].Rows.Count; i++)
                {
                    categories += "\"" + category1.Tables[0].Rows[i]["id"].ToString() + "\"" + ":" + "\"" + category1.Tables[0].Rows[i]["categoryName"].ToString() + "\"" + ",";
                }
            }
            categories  = categories.Substring(0, categories.Length - 1);
            categories += "}";
        }