//批量删除
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("productlist", MXEnums.ActionEnum.Delete.ToString()); //检查权限
            int sucCount   = 0;                                                 //成功数量
            int errorCount = 0;                                                 //失败数量

            BLL.wx_product bll     = new BLL.wx_product();
            Repeater       rptList = new Repeater();

            rptList = this.rptList1;

            for (int i = 0; i < rptList.Items.Count; i++)
            {
                int      id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
                CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
                if (cb.Checked)
                {
                    if (bll.Delete(id))
                    {
                        sucCount++;
                    }
                    else
                    {
                        errorCount++;
                    }
                }
            }
            AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "删除产品库内容成功" + sucCount + "条,失败" + errorCount + "条"); //记录日志
            Response.Redirect(Utils.CombUrlTxt("product_list.aspx", "category_id={0}&keywords={1}",
                                               ddlCategoryId.SelectedValue, this.keywords));
        }
Esempio n. 2
0
        private void ShowInfo(int _id)
        {
            BLL.wx_product   bll   = new BLL.wx_product();
            Model.wx_product model = bll.GetModel(_id);

            ddlCategoryId.SelectedValue = model.typeId.Value.ToString();

            this.lblid.Text       = model.id.ToString();
            this.txtTitle.Text    = model.hdName;
            this.txtpSubject.Text = model.pSubject;

            this.txtbeginDate.Text = model.beginDate == null ? "" : model.beginDate.Value.ToString("yyyy-MM-dd HH:mm:ss");
            this.txtendDate.Text   = model.endDate == null ? "" : model.endDate.Value.ToString("yyyy-MM-dd HH:mm:ss");
            this.txtaddr.Text      = model.addr;
            this.txtContent.Value  = model.pContent;
            txtImgUrl.Text         = model.extStr2;

            this.txtPrice.Text         = model.price == null ? "" : model.price.Value.ToString();
            this.chkShowDate.Checked   = model.showDate;
            this.chkShowPrice.Checked  = model.showPrice;
            this.chkShowYuDing.Checked = model.showYuDing;
            this.txtAnNiuTxt.Text      = model.btnName == "" ? "预定" : model.btnName;
            this.txtSortId.Text        = model.extInt == null ? "99" : model.extInt.Value.ToString();
            txtUrl.Text = model.url == null ? "" : model.url;
        }
        private void RptBind(int _category_id, string _strWhere, string _orderby)
        {
            Model.wx_userweixin weixin = GetWeiXinCode();

            this.page = MXRequest.GetQueryInt("page", 1);
            if (this.category_id > 0)
            {
                this.ddlCategoryId.SelectedValue = _category_id.ToString();
            }

            this.txtKeywords.Text = this.keywords;
            //列表显示
            BLL.wx_product bll = new BLL.wx_product();
            DataSet artDs = bll.GetWCodeList(weixin.id,_category_id, this.pageSize, this.page, _strWhere, _orderby, out this.totalCount);

            //链接处理,待做
            if (artDs != null)
            {
                DataRow dr;
                for (int i = 0; i < artDs.Tables[0].Rows.Count; i++)
                {
                    dr = artDs.Tables[0].Rows[i];
                    dr["url"] = " <a href=\"javascript:;\">" + MyCommFun.getWebSite() + "/weixin/product/detail.aspx?wid=" + MyCommFun.ObjToStr(dr["wid"]) + "&id=" + dr["id"] + "</a>";
                }
            }

            this.rptList1.DataSource = artDs;
            this.rptList1.DataBind();
            

            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("product_list.aspx", "category_id={0}&keywords={1}&page={2}", ddlCategoryId.SelectedValue, this.keywords, "__id__");
            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
        private void ShowInfo(int _id)
        {
            BLL.wx_product bll = new BLL.wx_product();
            Model.wx_product model = bll.GetModel(_id);

            ddlCategoryId.SelectedValue = model.typeId.Value.ToString();

            this.lblid.Text = model.id.ToString();
            this.txtTitle.Text = model.hdName;
            this.txtpSubject.Text = model.pSubject;

            this.txtbeginDate.Text = model.beginDate == null ? "" : model.beginDate.Value.ToString("yyyy-MM-dd HH:mm:ss");
            this.txtendDate.Text = model.endDate == null ? "" : model.endDate.Value.ToString("yyyy-MM-dd HH:mm:ss");
            this.txtaddr.Text = model.addr;
            this.txtContent.Value = model.pContent;
            txtImgUrl.Text = model.extStr2;
           
            this.txtPrice.Text = model.price == null ? "" : model.price.Value.ToString();
            this.chkShowDate.Checked = model.showDate;
            this.chkShowPrice.Checked = model.showPrice;
            this.chkShowYuDing.Checked = model.showYuDing;
            this.txtAnNiuTxt.Text = model.btnName == "" ? "预定" : model.btnName;
            this.txtSortId.Text = model.extInt == null ? "99" : model.extInt.Value.ToString();
            txtUrl.Text = model.url == null ? "" : model.url;

                
        }
Esempio n. 5
0
        //批量删除
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("productlist", MXEnums.ActionEnum.Delete.ToString()); //检查权限
            int sucCount = 0; //成功数量
            int errorCount = 0; //失败数量
            BLL.wx_product bll = new BLL.wx_product();
            Repeater rptList = new Repeater();
            rptList = this.rptList1;

            for (int i = 0; i < rptList.Items.Count; i++)
            {
                int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
                CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
                if (cb.Checked)
                {
                    if (bll.Delete(id))
                    {
                        sucCount++;
                    }
                    else
                    {
                        errorCount++;
                    }
                }
            }
            AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "删除产品库内容成功" + sucCount + "条,失败" + errorCount + "条"); //记录日志
            Response.Redirect(Utils.CombUrlTxt("product_list.aspx", "category_id={0}&keywords={1}",
              ddlCategoryId.SelectedValue, this.keywords));
        }
Esempio n. 6
0
        private bool DoAdd()
        {
            Model.wx_userweixin weixin = GetWeiXinCode();

            bool result = false;

            Model.wx_product model = new Model.wx_product();
            BLL.wx_product   bll   = new BLL.wx_product();

            string   hdName     = this.txtTitle.Text;
            string   hdSubject  = this.txtpSubject.Text;
            string   hdAddr     = this.txtaddr.Text;
            string   hdContent  = this.txtContent.Value;
            DateTime createTime = DateTime.Now;
            string   tupian     = txtImgUrl.Text;//封面图片
            decimal  price      = decimal.Parse(txtPrice.Text);
            bool     showDate   = chkShowDate.Checked;
            bool     showPrice  = chkShowPrice.Checked;
            bool     showYuDing = chkShowYuDing.Checked;
            int      seq        = MyCommFun.Str2Int(txtSortId.Text);

            model.hdName   = hdName;
            model.pSubject = hdSubject;

            model.addr       = hdAddr;
            model.pContent   = hdContent;
            model.extStr2    = tupian;
            model.btnName    = txtAnNiuTxt.Text.Trim();
            model.typeId     = MyCommFun.Str2Int(ddlCategoryId.SelectedItem.Value);
            model.price      = price;
            model.showDate   = showDate;
            model.showPrice  = showPrice;
            model.showYuDing = showYuDing;
            model.extInt     = seq;
            model.wid        = weixin.id;
            model.url        = txtUrl.Text.Trim();
            model.createDate = DateTime.Now;
            if (txtbeginDate.Text.Trim() != "")
            {
                if (MyCommFun.isDateTime(txtbeginDate.Text))
                {
                    model.beginDate = DateTime.Parse(txtbeginDate.Text);
                }
            }

            if (txtendDate.Text.Trim() != "")
            {
                if (MyCommFun.isDateTime(txtendDate.Text))
                {
                    model.endDate = DateTime.Parse(txtendDate.Text);
                }
            }
            if (bll.Add(model) > 0)
            {
                AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "添加产品库信息:" + model.hdName); //记录日志
                result = true;
            }
            return(result);
        }
Esempio n. 7
0
        //保存排序
        protected void btnSave_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("productlist", MXEnums.ActionEnum.Edit.ToString()); //检查权限
            BLL.wx_product bll = new BLL.wx_product();
            Repeater rptList = new Repeater();
             rptList = this.rptList1;

            for (int i = 0; i < rptList.Items.Count; i++)
            {
                int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
                int sortId;
                if (!int.TryParse(((TextBox)rptList.Items[i].FindControl("txtSortId")).Text.Trim(), out sortId))
                {
                    sortId = 99;
                }
                bll.UpdateField(id, "extInt=" + sortId.ToString());
            }
            AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "保存产品库排序"); //记录日志
            Response.Redirect(Utils.CombUrlTxt("product_list.aspx", "category_id={0}&keywords={1}",
               ddlCategoryId.SelectedValue, this.keywords));
        }
        //保存排序
        protected void btnSave_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("productlist", MXEnums.ActionEnum.Edit.ToString()); //检查权限
            BLL.wx_product bll     = new BLL.wx_product();
            Repeater       rptList = new Repeater();

            rptList = this.rptList1;

            for (int i = 0; i < rptList.Items.Count; i++)
            {
                int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
                int sortId;
                if (!int.TryParse(((TextBox)rptList.Items[i].FindControl("txtSortId")).Text.Trim(), out sortId))
                {
                    sortId = 99;
                }
                bll.UpdateField(id, "extInt=" + sortId.ToString());
            }
            AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "保存产品库排序"); //记录日志
            Response.Redirect(Utils.CombUrlTxt("product_list.aspx", "category_id={0}&keywords={1}",
                                               ddlCategoryId.SelectedValue, this.keywords));
        }
        private void RptBind(int _category_id, string _strWhere, string _orderby)
        {
            Model.wx_userweixin weixin = GetWeiXinCode();

            this.page = MXRequest.GetQueryInt("page", 1);
            if (this.category_id > 0)
            {
                this.ddlCategoryId.SelectedValue = _category_id.ToString();
            }

            this.txtKeywords.Text = this.keywords;
            //列表显示
            BLL.wx_product bll   = new BLL.wx_product();
            DataSet        artDs = bll.GetWCodeList(weixin.id, _category_id, this.pageSize, this.page, _strWhere, _orderby, out this.totalCount);

            //链接处理,待做
            if (artDs != null)
            {
                DataRow dr;
                for (int i = 0; i < artDs.Tables[0].Rows.Count; i++)
                {
                    dr        = artDs.Tables[0].Rows[i];
                    dr["url"] = " <a href=\"javascript:;\">" + MyCommFun.getWebSite() + "/weixin/product/detail.aspx?wid=" + MyCommFun.ObjToStr(dr["wid"]) + "&id=" + dr["id"] + "</a>";
                }
            }

            this.rptList1.DataSource = artDs;
            this.rptList1.DataBind();


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

            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
Esempio n. 10
0
        public void BindData(int id)
        {
            BLL.wx_product   hdBll   = new BLL.wx_product();
            Model.wx_product huodong = hdBll.GetModel(id);
            Page.Title    = huodong.hdName;
            litTheme.Text = huodong.pSubject;

            litCreateDate.Text = huodong.createDate == null ? "" : huodong.createDate.Value.ToString("yyyy-MM-dd");
            if (huodong.extStr2 == null || huodong.extStr2.ToString().Trim() == "")
            {
                imgPic.Style.Add("display", "none");
            }
            else
            {
                imgPic.ImageUrl = huodong.extStr2;
            }
            StringBuilder detailSB = new StringBuilder();

            if (isNotNullFun(huodong.beginDate))
            {
                detailSB.Append(" <li class=\"newsmore\"><div class=\"olditem\">");
                detailSB.Append("时间 :" + huodong.beginDate.Value.ToShortDateString() + " ~ ");
                if (isNotNullFun(huodong.endDate))
                {
                    detailSB.Append(huodong.endDate.Value.ToShortDateString());
                }
                detailSB.Append(" </div></li>\r\n");
            }
            if (isNotNullFun(huodong.addr))
            {
                detailSB.Append(" <li class=\"newsmore\"><div class=\"olditem\">");
                detailSB.Append("地点 :" + huodong.addr);
                detailSB.Append(" </div></li>\r\n");
            }

            if (isNotNullFun(huodong.pContent))
            {
                //detailSB.Append(" <li class=\"newsmore\"><div class=\"olditem\">");
                //detailSB.Append("活动内容 :");
                //detailSB.Append(" </div></li>\r\n");
                //detailSB.Append(" <li class=\"newsmore\"><div class=\"olditem\">");
                //detailSB.Append("  " + huodong.hdContent);
                //detailSB.Append(" </div></li>\r\n");
                litContent.Text = huodong.pContent;
            }

            litDetail.Text = detailSB.ToString();

            //底部菜单设置
            int    wid    = MyCommFun.RequestInt("wid");
            string openid = MyCommFun.RequestOpenid();

            BLL.wx_product_type   hdtypeBll  = new BLL.wx_product_type();
            Model.wx_product_type type       = hdtypeBll.GetModel(huodong.typeId.Value);
            StringBuilder         bottomMenu = new StringBuilder("");
            int num_dh = 0;

            if (isNotNullFun(type.tel))
            {
                num_dh++;
                bottomMenu.Append("  <li> <a href=\"tel:" + type.tel + "\">");
                bottomMenu.Append("  <img src=\"/images/templates/bottommenu/181.png\"><label>联系电话</label></a></li>");
            }

            if (isNotNullFun(type.daohangurl))
            {
                num_dh++;
                bottomMenu.Append(" <li> <a href=\"" + type.daohangurl + "\">");
                bottomMenu.Append(" <img src=\"/images/templates/bottommenu/131.png\"><label>一键导航</label></a>  </li>");
            }
            if (isNotNullFun(type.showDefault) && type.showDefault)
            {
                bottomMenu.Append(" <li class=\"home\"><a href=\"/index.aspx?wid=" + wid + "&openid=" + openid + "\"></a></li>");
            }

            num_dh++;
            if (isNotNullFun(huodong.url))
            {
                num_dh++;
                string yudingName = "在线预定";
                if (isNotNullFun(huodong.btnName))
                {
                    yudingName = huodong.btnName;
                }
                bottomMenu.Append(" <li> <a href=\"" + huodong.url + "\">");
                bottomMenu.Append(" <img src=\"/images/templates/bottommenu/127.png\"><label>" + yudingName + "</label></a>  </li>");
            }
            if (num_dh == 4)
            {
                bottomMenu.Append("<li> <a href=\"http://m.baidu.com\">");
                bottomMenu.Append("<img src=\"/images/templates/bottommenu/43.png\"><label>百度搜索</label></a>  </li>");
            }

            litdaohang.Text = bottomMenu.ToString();
        }
Esempio n. 11
0
        public void BindData(int id)
        {
            BLL.wx_product hdBll = new BLL.wx_product();
            Model.wx_product huodong = hdBll.GetModel(id);
            Page.Title = huodong.hdName;
            litTheme.Text = huodong.pSubject;

            litCreateDate.Text = huodong.createDate == null ? "" : huodong.createDate.Value.ToString("yyyy-MM-dd");
            if (huodong.extStr2 == null || huodong.extStr2.ToString().Trim() == "")
            {
                imgPic.Style.Add("display", "none");
            }
            else
            {
                imgPic.ImageUrl = huodong.extStr2;
            }
            StringBuilder detailSB = new StringBuilder();

            if (isNotNullFun(huodong.beginDate))
            {
                detailSB.Append(" <li class=\"newsmore\"><div class=\"olditem\">");
                detailSB.Append("时间 :" + huodong.beginDate.Value.ToShortDateString() + " ~ ");
                if (isNotNullFun(huodong.endDate))
                {
                    detailSB.Append(huodong.endDate.Value.ToShortDateString());
                }
                detailSB.Append(" </div></li>\r\n");

            }
            if (isNotNullFun(huodong.addr))
            {
                detailSB.Append(" <li class=\"newsmore\"><div class=\"olditem\">");
                detailSB.Append("地点 :" + huodong.addr);
                detailSB.Append(" </div></li>\r\n");
            }

            if (isNotNullFun(huodong.pContent))
            {
                //detailSB.Append(" <li class=\"newsmore\"><div class=\"olditem\">");
                //detailSB.Append("活动内容 :");
                //detailSB.Append(" </div></li>\r\n");
                //detailSB.Append(" <li class=\"newsmore\"><div class=\"olditem\">");
                //detailSB.Append("  " + huodong.hdContent);
                //detailSB.Append(" </div></li>\r\n");
                litContent.Text = huodong.pContent;
            }

            litDetail.Text = detailSB.ToString();

            //底部菜单设置
            int wid = MyCommFun.RequestInt("wid");
            string openid = MyCommFun.RequestOpenid();
            BLL.wx_product_type hdtypeBll = new BLL.wx_product_type();
            Model.wx_product_type type = hdtypeBll.GetModel(huodong.typeId.Value);
            StringBuilder bottomMenu = new StringBuilder("");
            int num_dh = 0;
            if (isNotNullFun(type.tel))
            {
                num_dh++;
                bottomMenu.Append("  <li> <a href=\"tel:"+type.tel+"\">");
                bottomMenu.Append("  <img src=\"/images/templates/bottommenu/181.png\"><label>联系电话</label></a></li>");
            }

            if (isNotNullFun(type.daohangurl))
            {
                num_dh++;
                bottomMenu.Append(" <li> <a href=\""+type.daohangurl+"\">");
                bottomMenu.Append(" <img src=\"/images/templates/bottommenu/131.png\"><label>一键导航</label></a>  </li>");  
            }
            if (isNotNullFun(type.showDefault) && type.showDefault)
            {
                bottomMenu.Append(" <li class=\"home\"><a href=\"/index.aspx?wid=" + wid + "&openid=" + openid + "\"></a></li>");
            }
           
            num_dh++;
            if (isNotNullFun(huodong.url))
            {
                num_dh++;
                string yudingName = "在线预定";
                if (isNotNullFun(huodong.btnName))
                {
                    yudingName = huodong.btnName;
                }
                bottomMenu.Append(" <li> <a href=\"" + huodong.url+ "\">");
                bottomMenu.Append(" <img src=\"/images/templates/bottommenu/127.png\"><label>" + yudingName + "</label></a>  </li>");
            }
            if (num_dh == 4)
            {
                bottomMenu.Append("<li> <a href=\"http://m.baidu.com\">");
                bottomMenu.Append("<img src=\"/images/templates/bottommenu/43.png\"><label>百度搜索</label></a>  </li>");
            }

            litdaohang.Text = bottomMenu.ToString();
            
        }
        private bool DoEdit(int _id)
        {
            Model.wx_userweixin weixin = GetWeiXinCode();

            bool result = false;
           
            BLL.wx_product bll = new BLL.wx_product();
            Model.wx_product model = bll.GetModel(_id);
            string hdName = this.txtTitle.Text;
            string hdSubject = this.txtpSubject.Text;
            string hdAddr = this.txtaddr.Text;
            string hdContent = this.txtContent.Value;
            DateTime createTime = DateTime.Now;
            string tupian = txtImgUrl.Text;//封面图片
            decimal price = decimal.Parse(txtPrice.Text);
            bool showDate = chkShowDate.Checked;
            bool showPrice = chkShowPrice.Checked;
            bool showYuDing = chkShowYuDing.Checked;
            int seq = MyCommFun.Str2Int(txtSortId.Text);

            model.hdName = hdName;
            model.pSubject = hdSubject;

            model.addr = hdAddr;
            model.pContent = hdContent;
            model.extStr2 = tupian;
            model.btnName = txtAnNiuTxt.Text.Trim();
            model.typeId = MyCommFun.Str2Int(ddlCategoryId.SelectedItem.Value);
            model.price = price;
            model.showDate = showDate;
            model.showPrice = showPrice;
            model.showYuDing = showYuDing;
            model.extInt = seq;

            if (txtbeginDate.Text.Trim() != "")
            {
                if (MyCommFun.isDateTime(txtbeginDate.Text))
                {
                    model.beginDate = DateTime.Parse(txtbeginDate.Text);
                }
            }
            else
            {
                model.beginDate = null;
            }

            if (txtendDate.Text.Trim() != "")
            {
                if (MyCommFun.isDateTime(txtendDate.Text))
                {
                    model.endDate = DateTime.Parse(txtendDate.Text);
                }
            }
            else
            {
                model.endDate = null;
            }

            //model.wid = weixin.id;
            model.url = txtUrl.Text.Trim();

            if (bll.Update(model))
            {

                AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "修改产品库内容id:" + model.id); //记录日志
                result = true;
            }
            return result;
        }