Ejemplo n.º 1
0
        private void Bind()
        {
            int status = RequestHelper.QueryInt("searchStatus");
            string keytype = RequestHelper.Query("keytype");
            string keyword = RequestHelper.Query("keyword");

            List<string> statusResult = BaseStatusCtrl.GetStatusHtml(status);
            this.searchStatus.Text = statusResult[0];
            this.selectStatus.Text = statusResult[1];
            this.targetStatus.Text = statusResult[2];

            StringBuilder condition = new StringBuilder("where 1=1");

            if (status != (int)BaseStatus.全部)
            {
                condition.AppendFormat("and status={0}", status);
            }

            if (!string.IsNullOrEmpty(keytype) && !string.IsNullOrEmpty(keyword))
            {
                switch (keytype)
                {
                    case "attrId":
                        condition.AppendFormat(" and AttrId={0}", Utils.StrToInt(keyword));
                        break;
                    case "attr":
                        condition.AppendFormat(" and attr='{0}'", keyword);
                        break;
                    case "valueId":
                        condition.AppendFormat(" and ValueId={0}", Utils.StrToInt(keyword));
                        break;
                    case "value":
                        condition.AppendFormat(" and Value='{0}'", keyword);
                        break;
                }
                this.keytype.Value = keytype;
                this.keyword.Value = keyword;

            }
            condition.AppendFormat(" order by ValueId desc");

            Paging paging = new Paging(30);
            this.DateList.DataSource = AttrValueService.GetAttrValueList(paging, condition.ToString());
            this.DateList.DataBind();
            this.paging.Text = paging.GetHtml();
        }
Ejemplo n.º 2
0
        private void Bind()
        {
            int status = RequestHelper.QueryInt("searchStatus");
            string keytype = RequestHelper.Query("keytype");
            string keyword = RequestHelper.Query("keyword");
            int cateId = RequestHelper.QueryInt("cateList");

            List<string> statusResult = BaseStatusCtrl.GetStatusHtml(status);
            this.searchStatus.Text = statusResult[0];
            this.selectStatus.Text = statusResult[1];
            this.targetStatus.Text = statusResult[2];

            Dictionary<int, string> categoryList = CateService.GetCateDropList("cateList", 0, 0);
            this.cateList.DataSource = categoryList;
            this.cateList.DataValueField = "Key";
            this.cateList.DataTextField = "Value";
            this.cateList.DataBind();
            this.cateList.Items.Insert(0, new ListItem("请选择", ""));

            this.targetCateList.DataSource = categoryList;
            this.targetCateList.DataValueField = "Key";
            this.targetCateList.DataTextField = "Value";
            this.targetCateList.DataBind();

            StringBuilder condition = new StringBuilder("where 1=1");

            if (status != (int)BaseStatus.全部)
            {
                condition.AppendFormat("and status={0}", status);
            }

            if (cateId > 0)
            {
                CateInfo categoryInfo = CateService.GetCateInfo(cateId);
                if (categoryInfo != null)
                {
                    condition.AppendFormat(" and Lid={0} and Rid={1}", categoryInfo.Lid, categoryInfo.Rid);
                    this.cateList.Value = cateId.ToString();
                }
            }

            if (!string.IsNullOrEmpty(keytype) && !string.IsNullOrEmpty(keyword))
            {
                switch (keytype)
                {
                    case "attrId":
                        condition.AppendFormat(" and AttrId={0}", Utils.StrToInt(keyword));
                        break;
                    case "attr":
                        condition.AppendFormat(" and Attr='{0}'", keyword);
                        break;
                }
                this.keytype.Value = keytype;
                this.keyword.Value = keyword;

            }
            condition.AppendFormat(" order by AttrId desc");

            Paging paging = new Paging(30);
            this.DateList.DataSource = AttrService.GetAttrList(paging, condition.ToString());
            this.DateList.DataBind();
            this.paging.Text = paging.GetHtml();
        }