コード例 #1
0
ファイル: caipin_manage.aspx.cs プロジェクト: yidane/51wine
        private void RptBind(string _strWhere, string _orderby)
        {
            // Model.wx_userweixin weixin = GetWeiXinCode();

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


            _strWhere        = " and aa.shopid=" + shopid + " " + _strWhere;//and
            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("caipin_manage.aspx", "keywords={0}&page={1}&shopid={2}", this.keywords, "__id__", shopid.ToString());

            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
コード例 #2
0
        private void RptBind(string _strWhere, string _orderby)
        {

           // Model.wx_userweixin weixin = GetWeiXinCode();

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


            _strWhere = " and aa.shopid=" + shopid + " " + _strWhere;//and
            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("caipin_manage.aspx", "keywords={0}&page={1}&shopid={2}", this.keywords, "__id__", shopid.ToString());
            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);


        }
コード例 #3
0
        public void List(int ids)
        {
            //订单
            Dingdanlist = "";
            dingdanren  = "";

            DataSet dr = managebll.Getcommodity(cid);

            if (dr.Tables[0].Rows.Count > 0)
            {
                decimal amount = 0;

                if (dr.Tables[0].Rows[0]["status"].ToString() == "2")
                {
                    save_groupbase.Text        = "已验证";
                    save_groupbase.Enabled     = false;
                    save_groupbase.Style.Value = "";
                }
                Dingdanlist += "<tr><th>套餐名称</th><th class=\"cc\">购买份数</th><th class=\"cc\">单价</th><th class=\"rr\">总价</th> </tr>";
                for (int i = 0; i < dr.Tables[0].Rows.Count; i++)
                {
                    Dingdanlist += " <tr><td  class=\"cc\">" + dr.Tables[0].Rows[i]["cpName"] + "</td>";
                    Dingdanlist += "<td class=\"cc\">" + 1 + "</td>";
                    Dingdanlist += "<td class=\"cc\">" + dr.Tables[0].Rows[i]["price"] + "</td>";
                    Dingdanlist += "<td class=\"rr\">¥" + dr.Tables[0].Rows[i]["price"] + "</td></tr>";
                    amount      += Convert.ToDecimal(dr.Tables[0].Rows[i]["price"]);
                }

                Dingdanlist += "<tr><td></td><td ></td><td ></td><td class=\"rr\" style=\"color: red; font-weight:bold;\">总计:¥" + amount + "</td></tr>";
            }

            manage = managebll.GetModeldingdan(id);
            //获取菜品有效期
            string caipinRange   = string.Empty;
            bool   isInRange     = true;
            var    caipinManager = new BLL.wx_diancai_caipin_manage().GetModel(ids);

            if (caipinManager != null)
            {
                if (caipinManager.beginDate != null && caipinManager.endDate != null)
                {
                    caipinRange = string.Format("{0}至{1}", caipinManager.beginDate.Value.ToString("yyyy-MM-dd"), caipinManager.endDate.Value.ToString("yyyy-MM-dd"));
                    if (manage.createDate > caipinManager.endDate.Value)
                    {
                        isInRange = false;
                    }
                }
            }

            //订单信息
            if (manage != null)
            {
                dingdanren += "<tr><td width=\"70\">订单编号: " + manage.orderNumber + "</td></tr>";
                dingdanren += "<tr> <td>预订日期:" + manage.oderTime + "</td></tr>";

                if (!string.IsNullOrEmpty(caipinRange))
                {
                    dingdanren += "<tr> <td>订单有效期:" + caipinRange + "</td></tr>";
                }

                dingdanren += "<tr><td>预约人:" + manage.customerName + "</td></tr>";
                dingdanren += "<tr><td>电话:" + manage.customerTel + "</td></tr>";
                //dingdanren += "<tr><td>地址:" + manage.address + "</td></tr>";
                //dingdanren += "<tr><td>备注 :" + manage.oderRemark + "</td></tr>";
                if (manage.payStatus == StatusManager.PayStatus.Payed.StatusID)
                {
                    dingdanren += "<tr><td>订单状态:<em  style='width:70px;' class='ok'>等待使用</em></td></tr>";
                }
                else if (manage.payStatus == StatusManager.PayStatus.PartUsed.StatusID)
                {
                    dingdanren += "<tr><td>订单状态:<em  style='width:70px;' class='ok'>部分使用</em></td></tr>";
                }
                else if (manage.payStatus == StatusManager.PayStatus.PartRefund.StatusID)
                {
                    dingdanren += "<tr><td>订单状态:<em  style='width:70px;' class='ok'>部分退款</em></td></tr>";
                }
                else
                {
                    dingdanren += "<tr><td>订单状态:<em  style='width:70px;' class='no'>未使用</em></td></tr>";
                }

                //如果订单已经过期,提醒管理员
                if (!isInRange)
                {
                    dingdanren += "<tr><td>订单状态:<em  style='width:70px;font-size:1.3em' class='error'>当前订单已经过期</em></td></tr>";
                }
            }
            else
            {
                dingdanren += "<tr><td width=\"70\">订单编号:</td></tr>";
                dingdanren += "<tr> <td>预订日期:</td></tr>";
                dingdanren += "<tr><td>预约人:</td></tr>";
                dingdanren += "<tr><td>电话:</td></tr>";
                //dingdanren += "<tr><td>地址:</td></tr>";
                //dingdanren += "<tr><td>备注 :</td></tr>";

                dingdanren += "<tr><td>订单状态:<em  style='width:70px;' class='no'>未使用</em></td></tr>";
            }
        }
コード例 #4
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();
            }
        }