Exemple #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.category_id = Utils.StrToInt(MXRequest.GetQueryString("aid"), 0);
            int id = MyCommFun.RequestInt("id");

            wid = MyCommFun.RequestWid();
            if (!IsPostBack)
            {
                IList <Model.wx_qp_img> imglist = imgBLL.GetModelList("bId=" + category_id + "and iType=2  order by id desc ");

                for (int i = 0; i < imglist.Count; i++)
                {
                    if (imglist[i].id == id)
                    {
                        actNum = i;
                        break;
                    }
                }
                int test = actNum;
                this.rptImgshow.DataSource = imglist;
                this.rptImgshow.DataBind();
                Model.wx_qp_base baseMod = baseBll.GetModel(this.category_id);
                this.Page.Title = baseMod.bName;
            }
        }
Exemple #2
0
        private void BindData()
        {
            BLL.wx_qp_img             imgBLl    = new BLL.wx_qp_img();
            BLL.wx_qp_base            actBll    = new BLL.wx_qp_base();
            BLL.wx_qp_users           usersBll  = new BLL.wx_qp_users();
            Model.wx_qp_base          baseModel = actBll.GetModelList(" id=" + aid)[0];
            IList <Model.wx_qp_users> userList  = usersBll.GetModelList(string.Format(" openid='{0}' and bId={1}", openid, aid));

            //判断活动是否过期
            if (baseModel.actEnd < DateTime.Now || baseModel.actBegin > DateTime.Now)
            {
                ErrLevel  = 1;
                ErrorInfo = "此活动时间不对,很遗憾!";
                return;
            }
            if (userList.Count > 0)
            {
                ErrLevel  = 1;
                ErrorInfo = "你已参加过活动,每人只能参加一次!";
                return;
            }

            //轮播图片
            this.rptImglist.DataSource = imgBLl.GetList(" bId=" + aid + " and iType=3 ");
            if (imgBLl.GetList(" bId=" + aid + " and iType=3 ").Tables[0].Rows.Count <= 0)
            {
                mark = "no";
            }
            this.rptImglist.DataBind();
            this.rptNum.DataSource = imgBLl.GetList(" bId=" + aid + " and iType=3 ");
            this.rptNum.DataBind();

            this.Page.Title     = baseModel.bName;
            this.ltrUserxz.Text = baseModel.qpRemark;
        }
Exemple #3
0
        /// <summary>
        /// 电影院抢票
        /// </summary>
        /// <param name="id"></param>
        /// <param name="apiid"></param>
        /// <param name="openid"></param>
        /// <returns></returns>
        private IList <Model.ResponseContentEntity> DDYQPReponse(int id, int apiid, string openid)
        {
            IList <Model.ResponseContentEntity> responselist = new List <Model.ResponseContentEntity>();

            Model.ResponseContentEntity responseEntity = new Model.ResponseContentEntity();
            responseEntity.id  = id;
            responseEntity.wid = apiid;

            BLL.wx_qp_base   ggkActBll = new BLL.wx_qp_base();
            Model.wx_qp_base actModel  = ggkActBll.GetModel(id);
            if (actModel.actBegin > DateTime.Now)
            {  //活动尚未开始
                responseEntity.rcType   = Model.ReponseContentType.text;
                responseEntity.rContent = "活动【" + actModel.bName + "】将于" + actModel.actBegin + "开始。";
            }
            else if (actModel.actEnd <= DateTime.Now)
            {
                //活动结束
                responseEntity.rcType   = Model.ReponseContentType.text;
                responseEntity.rContent = "活动已经结束了。";
            }
            else
            {
                //活动正在进行中
                responseEntity.rcType    = Model.ReponseContentType.txtpic;
                responseEntity.rContent  = actModel.bName;
                responseEntity.rContent2 = "";
                responseEntity.detailUrl = MyCommFun.getWebSite() + "/weixin/qiangpiao/index.aspx?wid=" + apiid + "&aid=" + id;
                responseEntity.picUrl    = actModel.beginPic;
            }
            responselist.Add(responseEntity);

            return(responselist);
        }
Exemple #4
0
        private void RptBind()
        {
            BLL.wx_qp_img  imgBll  = new BLL.wx_qp_img();
            BLL.wx_qp_base baseBll = new BLL.wx_qp_base();
            BLL.wx_qp_film filmBll = new BLL.wx_qp_film();
            //得到抢票活动相关信息
            IList <Model.wx_qp_base> qblist = baseBll.GetModelList("wid=" + wid + " and id=" + aid);

            if (qblist == null || qblist.Count <= 0)
            {
                return;
            }

            Model.wx_qp_base qpBase = qblist[0];
            litFilmhb.Text = "<img src=\"" + qpBase.haibaoPic + "\">";
            actName        = qpBase.bName;
            litJies.Text   = "<span>" + qpBase.yyRemark + "</span>";

            //得到所有热映电影
            DataSet ds = filmBll.GetList("bid=" + aid + " order by sort_id asc,id desc");

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

            //得到所有影院图片
            DataSet imgDs = imgBll.GetList(4, "bId=" + aid + " and iType=2 ", "id desc");

            this.rptImg.DataSource = imgDs;
            this.rptImg.DataBind();
        }
Exemple #5
0
        private void ShowInfo(int id)
        {
            hidid.Value = id.ToString();
            Model.wx_qp_base qpModel = baseBll.GetModel(id);

            Model.wx_requestRule rule = rBll.GetModelList("modelFunctionName='电影院抢票' and modelFunctionId=" + id)[0];
            txtKW.Text = rule.reqKeywords;

            if (qpModel.beginPic != null && qpModel.beginPic.Trim() != "/weixin/qiangpiao/images/qp1.jpg")
            {
                txtImgUrl.Text       = qpModel.beginPic;
                imgbeginPic.ImageUrl = qpModel.beginPic;
            }
            txtactName.Text = qpModel.bName;

            txtbeginDate.Text      = qpModel.actBegin.Value.ToString("yyyy-MM-dd HH:mm:ss");
            txtendDate.Text        = qpModel.actEnd.Value.ToString("yyyy-MM-dd HH:mm:ss");
            txthaibaoPic.Text      = qpModel.haibaoPic;
            txtyyRemark.Value      = qpModel.yyRemark;
            this.txtqpRemark.Value = qpModel.qpRemark;

            txtmaxPersonNum.Text         = qpModel.maxPersonNum.Value.ToString();
            rblisSnSendsms.SelectedValue = qpModel.isSnSendsms.ToString();

            txtyyGouPiaoBeginDate.Text = qpModel.yyGouPiaoBeginDate.Value.ToString("yyyy-MM-dd HH:mm:ss");
            txtyyGouPiaoEndDate.Text   = qpModel.yyGouPiaoEndDate.Value.ToString("yyyy-MM-dd HH:mm:ss");
            txtSortId.Text             = qpModel.sort_id.ToString();
            rptAlbumList.DataSource    = qpModel.yingyuanlist;
            rptAlbumList.DataBind();
        }
Exemple #6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     wid = MyCommFun.RequestWid();
     aid = MyCommFun.RequestInt("aid", 0);
     if (!IsPostBack)
     {
         this.rptImglist.DataSource = imgBLL.GetList("bId=" + this.aid + " and iType=2  order by id desc");
         this.rptImglist.DataBind();
         this.openid = MyCommFun.RequestOpenid();
         Model.wx_qp_base baseMod = baseBll.GetModel(this.aid);
         actName = baseMod.bName;
     }
 }
Exemple #7
0
        private void ckState()
        {
            BLL.wx_qp_base            actBll    = new BLL.wx_qp_base();
            BLL.wx_qp_users           userBll   = new BLL.wx_qp_users();
            Model.wx_qp_base          baseModel = actBll.GetModel(aid);
            IList <Model.wx_qp_users> userList  = userBll.GetModelList(" openid='" + openid + "' and bId=" + aid);

            Model.wx_qp_users userModel = null;
            string            gpTime    = DateTime.Parse(baseModel.yyGouPiaoBeginDate.ToString()).ToString("MM月dd日-HH:mm") +
                                          "~" + DateTime.Parse(baseModel.yyGouPiaoEndDate.ToString()).ToString("MM月dd日-HH:mm");

            if (userList != null && userList.Count > 0)
            {
                userModel = userList[0];
            }

            string Fulltext = "<h1><i class=\"text-icon\">✔</i>已有" + baseModel.maxPersonNum + "人抢到票啦!</h1>" +
                              "<dl class=\"list\">" +
                              "<dd class=\"dd-padding\">特价票已售完即止!</dd>" +
                              "<dd class=\"dd-padding\">请抓紧时间购票把!</dd>" +
                              "<dd class=\"dd-padding\">购票时间:" + gpTime + "</dd></dl><br />";

            //活动人数已满
            if (baseModel.cyPersonNum > baseModel.maxPersonNum)
            {
                this.litFull.Text = Fulltext;
                return;
            }

            //非法用户
            if (userModel == null)
            {
                if (baseModel.cyPersonNum == baseModel.maxPersonNum)//最后一个用户
                {
                    this.litFull.Text = Fulltext;
                }
                else
                {
                    Response.Redirect(string.Format("index.aspx?wid={0}&aid={1}&openid={2}", wid, aid, openid));
                }
                return;
            }

            //第一次参与活动
            if (joined == "true")
            {
                string snNum = userModel.sn;
                this.litShow.Text = "<h1><i class=\"text-icon\">✔</i>您是第" + baseModel.cyPersonNum + "位参加本次抢票!</h1>" +
                                    "<dl class=\"list\">" +
                                    "<dd class=\"dd-padding\">您的sn码:" + snNum + " </dd>" +
                                    "<dd class=\"dd-padding\">购票时间:" + gpTime + "</dd></dl><br />";
                return;
            }//已参与过本次活动,不可以再参加
            else if (joined == "false")
            {
                string snNum = userModel.sn;
                this.litJoined.Text = "<h1><i class=\"text-icon\">✔</i>您已成功参加本次抢票!</h1>" +
                                      "<dl class=\"list\">" +
                                      "<dd class=\"dd-padding\">您的sn码:" + snNum + " </dd>" +
                                      "<dd class=\"dd-padding\">购票时间:" + gpTime + "</dd></dl><br />";
                return;
            }
        }
Exemple #8
0
        //保存
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            Model.wx_userweixin weixin = GetWeiXinCode();

            Model.wx_requestRuleContent rc = new Model.wx_requestRuleContent();
            int id = MyCommFun.Str2Int(hidid.Value);

            #region  //先判断
            string strErr = "";
            if (this.txtKW.Text.Trim().Length == 0)
            {
                strErr += "关键词不能为空!";
            }
            if (this.txtactName.Text.Trim().Length == 0)
            {
                strErr += "活动名称不能为空!";
            }
            if (this.txtbeginDate.Text.Trim().Length == 0 || !MyCommFun.isDateTime(txtbeginDate.Text))
            {
                strErr += "开始时间不能为空!";
            }
            if (this.txtendDate.Text.Trim().Length == 0 || !MyCommFun.isDateTime(txtendDate.Text))
            {
                strErr += "结束时间不能为空!";
            }


            if (strErr != "")
            {
                JscriptMsg(strErr, "back", "Error");
                return;
            }
            DateTime begin = DateTime.Parse(txtbeginDate.Text.Trim());
            DateTime end   = DateTime.Parse(txtendDate.Text.Trim());
            if (begin >= end)
            {
                JscriptMsg("开始时间必须小于结束时间", "back", "Error");
                return;
            }
            #endregion

            #region 赋值
            Model.wx_qp_base     baseModel = new Model.wx_qp_base();
            Model.wx_requestRule rule      = new Model.wx_requestRule();

            string beginPic = imgbeginPic.ImageUrl;
            if (txtImgUrl.Text.Trim() != "")
            {
                beginPic = txtImgUrl.Text.Trim();
            }

            if (id > 0)
            {
                baseModel = baseBll.GetModel(id);
            }

            baseModel.bName = txtactName.Text.Trim();

            baseModel.actBegin = begin;
            baseModel.actEnd   = end;

            baseModel.yyRemark     = txtyyRemark.Value.Trim();
            baseModel.qpRemark     = txtqpRemark.Value.Trim();
            baseModel.maxPersonNum = MyCommFun.Str2Int(txtmaxPersonNum.Text.Trim());

            baseModel.isSnSendsms        = rblisSnSendsms.SelectedItem.Value == "1" ? true : false;
            baseModel.yyGouPiaoBeginDate = MyCommFun.Obj2DateTime(txtyyGouPiaoBeginDate.Text.Trim());
            baseModel.yyGouPiaoEndDate   = MyCommFun.Obj2DateTime(txtyyGouPiaoEndDate.Text.Trim());

            baseModel.beginPic  = beginPic;
            baseModel.haibaoPic = txthaibaoPic.Text.Trim();
            baseModel.sort_id   = MyCommFun.Str2Int(txtSortId.Text.Trim(), 0);
            #region 保存相册====================

            string[] albumArr  = Request.Form.GetValues("hid_photo_name");
            string[] remarkArr = Request.Form.GetValues("hid_photo_remark");
            bool     res       = imgBll.DeleteByBid(id, 2);
            if (albumArr != null && albumArr.Length > 0)
            {
                List <Model.wx_qp_img> ls = new List <Model.wx_qp_img>();
                for (int i = 0; i < albumArr.Length; i++)
                {
                    string[] imgArr = albumArr[i].Split('|');
                    int      img_id = Utils.StrToInt(imgArr[0], 0);
                    if (imgArr.Length == 3)
                    {
                        if (!string.IsNullOrEmpty(remarkArr[i]))
                        {
                            ls.Add(new Model.wx_qp_img {
                                id = img_id, imgPic = imgArr[1], remark = remarkArr[i]
                            });
                        }
                        else
                        {
                            ls.Add(new Model.wx_qp_img {
                                id = img_id, imgPic = imgArr[1]
                            });
                        }
                    }
                }
                baseModel.yingyuanlist = ls;
            }
            else
            {
                baseModel.yingyuanlist = null;
            }
            #endregion


            #endregion

            if (id <= 0)
            {  //新增
                baseModel.wid         = weixin.id;
                baseModel.cyPersonNum = 0;
                baseModel.createDate  = DateTime.Now;
                id = baseBll.Add(baseModel);

                //3 新增回复规则表
                AddRule(weixin.id, id);
                AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "添加电影院抢票活动,主键为" + id); //记录日志
                JscriptMsg("添加电影院抢票成功!", "action_list.aspx", "Success");
            }
            else
            {   //修改
                //1修改主表
                baseBll.Update(baseModel);

                //3 修改回复规则表
                IList <Model.wx_requestRule> rlist = rBll.GetModelList("modelFunctionName = '电影院抢票' and modelFunctionId=" + id);

                if (rlist != null && rlist.Count > 0)
                {
                    rule             = rlist[0];
                    rule.reqKeywords = txtKW.Text.Trim();
                    rBll.Update(rule);
                }
                else
                {
                    AddRule(weixin.id, id);
                }

                AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "修改电影院抢票,主键为" + id); //记录日志
                JscriptMsg("修改电影院抢票活动成功!", "action_list.aspx", "Success");
            }
        }
Exemple #9
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/json";
            int    aid     = MyCommFun.RequestInt("aid");
            int    wid     = MyCommFun.RequestWid();
            string openid  = MyCommFun.RequestOpenid();
            string _action = MXRequest.GetQueryString("mycat");

            BLL.wx_qp_base  actBll  = new wx_qp_base();
            BLL.wx_qp_users userBll = new BLL.wx_qp_users();
            //验证码
            if (_action == "sendCardCheckCode")
            {
                Model.wx_qp_base actModel  = actBll.GetModel(aid);
                string           actName   = actModel.bName;
                smsMgr           smgr      = null;
                string           Number    = string.Empty;
                string           smsStatus = string.Empty;
                string           telephone = MXRequest.GetQueryString("telephone");
                #region 验证码
                Dictionary <string, string> jsonDict = new Dictionary <string, string>();
                IList <Model.wx_qp_users>   userList = userBll.GetModelList(string.Format(" (openid='{0}'and bId={2}) or (uTel='{1}' and bId={2})", openid, telephone, aid));
                try
                {
                    if (Regexlib.IsValidMobile(telephone))
                    {
                        //判断是否超过活动最大人数
                        if (actModel.cyPersonNum >= actModel.maxPersonNum)
                        {
                            jsonDict.Add("errno", "sys");
                            jsonDict.Add("content", "活动人数已满!");
                            context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                            return;
                        }

                        if (userList.Count > 0)//已参加过本次活动,不发送验证码
                        {
                            jsonDict.Add("errno", "sys");
                            jsonDict.Add("content", "你已参加过本次活动!");
                            context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                            return;
                        }
                        smgr      = new smsMgr(wid);
                        Number    = Utils.Number(6, true);
                        smsStatus = smgr.SendSMS(telephone, Number + "(动态验证码),您于" + DateTime.Now.ToString("yyyy年MM月dd日 hh点mm分") + "参与\"" + actName + "\"抢票活动,请在10分钟内输入该验证码!", Number, actName, aid);
                        if (smsStatus == "成功")
                        {
                            //获取验证码
                            jsonDict.Add("errno", "0");
                            jsonDict.Add("content", "获取验证码成功");
                            context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                            return;
                        }
                        else
                        {
                            jsonDict.Add("errno", "sys");
                            jsonDict.Add("content", "发送验证码失败!");
                            context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                            return;
                        }
                    }
                    else
                    {
                        jsonDict.Add("errno", "sys");
                        jsonDict.Add("content", "手机格式错误!");
                        context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                        return;
                    }
                }
                catch (Exception ex)
                {
                    jsonDict.Add("errno", "sys");
                    jsonDict.Add("content", "发送验证码失败!");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    return;
                }

                #endregion
            }

            //index页面抢票时判断是否已参加过活动
            if (_action == "qp_ckJoined")
            {
                Dictionary <string, string> jsonDict = new Dictionary <string, string>();
                //判断此人是否已参与过活动
                bool joined = userBll.GetModelList(string.Format(" bId={0} and openid='{1}'", aid, openid)).Count > 0;
                if (joined)//已参与,跳转结果显示页面
                {
                    string goUrl = string.Format("order_Result.aspx?wid={0}&aid={1}&openid={2}&join=false", wid, aid, openid);
                    jsonDict.Add("errno", "0");
                    jsonDict.Add("content", goUrl);
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    return;
                }
                else//还未参与,跳转订单页面
                {
                    string goUrl = string.Format("order.aspx?wid={0}&aid={1}&openid={2}", wid, aid, openid);
                    jsonDict.Add("errno", "0");
                    jsonDict.Add("content", goUrl);
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    return;
                }
            }

            //抢票得到订单
            if (_action == "qp_ckOrder")
            {
                string                      identCode = MyCommFun.QueryString("identCode");
                string                      telephone = MyCommFun.QueryString("telephone");
                BLL.wx_sms_info             smsBll    = new BLL.wx_sms_info();
                Dictionary <string, string> jsonDict  = new Dictionary <string, string>();
                string                      goUrl     = "";
                //判断用户是否已经参与过活动
                IList <Model.wx_qp_users> userList = userBll.GetModelList(string.Format(" (openid='{0}'and bId={2}) or (uTel='{1}' and bId={2}) ", openid, telephone, aid));
                //判断验证码
                bool ckIdentcode = smsBll.ExistsYzm(telephone, identCode);

                Model.wx_qp_base actModel = actBll.GetModel(aid);

                //判断是否超过活动最大人数
                if (actModel.cyPersonNum >= actModel.maxPersonNum)
                {
                    jsonDict.Add("errno", "sys");
                    jsonDict.Add("content", "活动人数已满!");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    return;
                }
                if (userList.Count > 0)
                {
                    jsonDict.Add("errno", "sys");
                    jsonDict.Add("content", "你已参加过活动,每人只能参加一次!");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    return;
                }
                if (!Regexlib.IsValidMobile(telephone))
                {
                    jsonDict.Add("errno", "sys");
                    jsonDict.Add("content", "手机格式错误!");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    return;
                }
                if (!ckIdentcode)
                {
                    jsonDict.Add("errno", "sys");
                    jsonDict.Add("content", "验证码错误!");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    return;
                }



                Model.wx_qp_users model = new Model.wx_qp_users();
                model.bId        = aid;
                model.openid     = openid;
                model.uTel       = telephone;
                model.createDate = DateTime.Now;
                model.sn         = "sn_" + Utils.Number(6, true);
                //添加参与活动用户并给递加活动人数
                int res = userBll.Add(model);
                actModel.cyPersonNum  = actModel.cyPersonNum + 1;
                actModel.yingyuanlist = null;
                actBll.Update(actModel);

                //判断该活动是否发送SN码通知用户
                if (actModel.isSnSendsms && res > 0)//发送
                {
                    smsMgr smgr      = new smsMgr(wid);
                    string smsStatus = smgr.SendSMS("您于" + DateTime.Now.ToString("yyyy年MM月dd日 hh点mm分") + "参与\"" + actModel.bName + "\"抢票活动!恭喜你,抢票成功!(SN码)" + telephone, model.sn, model.sn, actModel.bName, aid);
                }
                goUrl = string.Format("order_Result.aspx?wid={0}&aid={1}&openid={2}&join=true", wid, aid, openid);
                jsonDict.Add("errno", "0");
                jsonDict.Add("content", goUrl);
                context.Response.Write(MyCommFun.getJsonStr(jsonDict));
            }
        }