/// <summary>
        /// 绑定右边列表
        /// </summary>
        private void BindDataList()
        {
            QueryParam qp = new QueryParam();

            qp.Orderfld  = Orderfld;
            qp.OrderType = 0;
            qp.PageSize  = 9999;
            int RecordCount = 0;


            //查询的方法
            qp.Where = BindSearch();

            List <Playngo_ClientZone_CampaignCategory> lst = Playngo_ClientZone_CampaignCategory.FindAll(qp, out RecordCount);

            qp.RecordCount      = RecordCount;
            RecordPages         = qp.Pages;
            lblRecordCount.Text = String.Format("{0} {2} / {1} {3}", RecordCount, RecordPages, ViewResourceText("Title_Items", "Items"), ViewResourceText("Title_Pages", "Pages"));

            if (lst != null && lst.Count > 0)
            {
                gvEventList.DataSource = SortList(lst, 0, 0);
            }
            //tlview.DataBind();
            gvEventList.DataBind();
        }
        protected void lbSort_Click(object sender, EventArgs e)
        {
            LinkButton ImgbutSort = (LinkButton)sender;

            if (ImgbutSort != null)
            {
                //查出当前要排序的字段
                Playngo_ClientZone_CampaignCategory objC = Playngo_ClientZone_CampaignCategory.FindByKeyForEdit(ImgbutSort.CommandArgument);

                mTips.IsPostBack = true;//回发时就要触发
                if (ImgbutSort.ToolTip == "up")
                {
                    Playngo_ClientZone_CampaignCategory.MoveField(objC, EnumMoveType.Up, ModuleId);
                    //字段上移成功
                    mTips.LoadMessage("UpMoveGroupSuccess", EnumTips.Success, this, new String[] { "" });
                }
                else
                {
                    Playngo_ClientZone_CampaignCategory.MoveField(objC, EnumMoveType.Down, ModuleId);
                    //字段下移成功

                    mTips.LoadMessage("DownMoveGroupSuccess", EnumTips.Success, this, new String[] { "" });
                }
                //绑定一下
                BindDataList();
            }
        }
        private int Compare(Playngo_ClientZone_CampaignCategory info1, Playngo_ClientZone_CampaignCategory info2)
        {
            int result;
            CaseInsensitiveComparer ObjectCompare = new CaseInsensitiveComparer();

            result = ObjectCompare.Compare(info1.Sort, info2.Sort);
            return(result);
        }
        protected void cmdUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                Playngo_ClientZone_CampaignCategory item = Playngo_ClientZone_CampaignCategory.FindByKeyForEdit(CategoryID);
                item.ContentText = txtContentText.Text;
                item.Name        = txtName.Text;


                item.LastIP   = WebHelper.UserHost;
                item.LastTime = xUserTime.UtcTime();
                item.LastUser = UserId;



                if (item.ID > 0)
                {
                }
                else
                {
                    QueryParam qp = new QueryParam();

                    item.Sort     = Playngo_ClientZone_CampaignCategory.FindMaxSort(ModuleId) + 1;
                    item.ModuleId = ModuleId;
                    item.PortalId = PortalId;
                }

                int Resultitem = 0;

                if (item.ID > 0)
                {
                    Resultitem = item.Update();
                }
                else
                {
                    Resultitem = item.Insert();
                }



                if (Resultitem > 0)
                {
                    mTips.LoadMessage("SaveCategorySuccess", EnumTips.Success, this, new String[] { item.Name });
                }
                else
                {
                    //保存失败
                    mTips.LoadMessage("SaveCategoryError", EnumTips.Success, this, new String[] { item.Name });
                }
                Response.Redirect(xUrl("CampaignCategory"), false);
            }
            catch (Exception ex)
            {
                ProcessModuleLoadException(ex);
            }
        }
 protected void cmdDeleteCategory_Click(object sender, EventArgs e)
 {
     try
     {
         Playngo_ClientZone_CampaignCategory item = Playngo_ClientZone_CampaignCategory.FindByKeyForEdit(CategoryID);
         if (item.ID > 0 && item.Delete() > 0)
         {
             mTips.LoadMessage("DeleteCategorySuccess", EnumTips.Success, this, new String[] { item.Name });
         }
         else
         {
             mTips.LoadMessage("DeleteCategoryError", EnumTips.Success, this, new String[] { item.Name });
         }
         Response.Redirect(xUrl("CampaignCategory"), false);
     }
     catch (Exception ex)
     {
         ProcessModuleLoadException(ex);
     }
 }
        /// <summary>
        /// 绑定左边项
        /// </summary>
        private void BindDataItem()
        {
            if (CategoryID > 0)
            {
                cmdDelete.Visible = true;
                cmdDelete.Attributes.Add("onClick", "javascript:return confirm('" + Localization.GetString("DeleteItem") + "');");

                Playngo_ClientZone_CampaignCategory item = Playngo_ClientZone_CampaignCategory.FindByKeyForEdit(CategoryID);
                txtName.Text = item.Name;



                txtContentText.Text = item.ContentText;
            }
            else
            {
                //新增界面
                cmdDelete.Visible   = false;
                txtName.Text        = "";
                txtContentText.Text = "";
            }
        }
        /// <summary>
        /// 状态应用按钮事件
        /// </summary>
        protected void btnApply_Click(object sender, EventArgs e)
        {
            try
            {
                Int32 Status = WebHelper.GetIntParam(Request, ddlStatus.UniqueID, -1);

                if (Status >= 0)
                {
                    string   Checkbox_Value       = WebHelper.GetStringParam(Request, "Checkbox", "");
                    string[] Checkbox_Value_Array = Checkbox_Value.Split(',');
                    Int32    IDX = 0;
                    for (int i = 0; i < Checkbox_Value_Array.Length; i++)
                    {
                        if (Int32.TryParse(Checkbox_Value_Array[i], out IDX))
                        {
                            Playngo_ClientZone_CampaignCategory item = Playngo_ClientZone_CampaignCategory.FindByKeyForEdit(IDX);
                            if (item != null && item.ID > 0)
                            {
                                mTips.IsPostBack = true;
                                if (item.Delete() > 0)
                                {
                                    //mTips.LoadMessage("DeleteCategorySuccess", EnumTips.Success, this, new String[] { item.Name });
                                }
                                else
                                {
                                    //mTips.LoadMessage("DeleteCategoryError", EnumTips.Success, this, new String[] { item.Name });
                                }
                            }
                        }
                    }
                    BindDataList();
                }
            }
            catch (Exception ex)
            {
                ProcessModuleLoadException(ex);
            }
        }
        /// <summary>
        /// 列表上的项删除事件
        /// </summary>
        protected void btnRemove_Click(object sender, EventArgs e)
        {
            try
            {
                LinkButton btnRemove = (LinkButton)sender;

                Playngo_ClientZone_CampaignCategory item = Playngo_ClientZone_CampaignCategory.FindByKeyForEdit(btnRemove.CommandArgument);
                mTips.IsPostBack = true;
                if (item.ID > 0 && item.Delete() > 0)
                {
                    mTips.LoadMessage("DeleteCategorySuccess", EnumTips.Success, this, new String[] { item.Name });
                }
                else
                {
                    mTips.LoadMessage("DeleteCategoryError", EnumTips.Success, this, new String[] { item.Name });
                }
                BindDataList();
            }
            catch (Exception ex)
            {
                ProcessModuleLoadException(ex);
            }
        }
        /// <summary>
        /// 列表行绑定
        /// </summary>
        protected void gvEventList_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                //还原出数据
                Playngo_ClientZone_CampaignCategory Categorie = e.Row.DataItem as Playngo_ClientZone_CampaignCategory;



                //移动分类按钮
                LinkButton lbSortUp         = e.Row.FindControl("lbSortUp") as LinkButton;
                LinkButton lbSortDown       = e.Row.FindControl("lbSortDown") as LinkButton;
                LinkButton lbMobileSortUp   = e.Row.FindControl("lbMobileSortUp") as LinkButton;
                LinkButton lbMobileSortDown = e.Row.FindControl("lbMobileSortDown") as LinkButton;
                lbSortUp.CommandArgument                     =
                    lbSortDown.CommandArgument               =
                        lbMobileSortUp.CommandArgument       =
                            lbMobileSortDown.CommandArgument = Categorie.ID.ToString();
                //编辑按钮
                HyperLink hlMobileEdit = e.Row.FindControl("hlMobileEdit") as HyperLink;
                HyperLink hlEdit       = e.Row.FindControl("hlEdit") as HyperLink;
                hlMobileEdit.NavigateUrl = hlEdit.NavigateUrl = xUrl("CategoryID", Categorie.ID.ToString(), "CampaignCategory");

                //删除按钮
                LinkButton btnRemove       = e.Row.FindControl("btnRemove") as LinkButton;
                LinkButton btnMobileRemove = e.Row.FindControl("btnMobileRemove") as LinkButton;
                btnRemove.CommandArgument = btnMobileRemove.CommandArgument = Categorie.ID.ToString();
                btnRemove.Attributes.Add("onClick", "javascript:return confirm('" + Localization.GetString("DeleteItem") + "');");
                btnMobileRemove.Attributes.Add("onClick", "javascript:return confirm('" + Localization.GetString("DeleteItem") + "');");

                //分类名称
                HyperLink hlCategorie = e.Row.FindControl("hlCategorie") as HyperLink;
                hlCategorie.Text = Categorie.Name;
                //hlCategorie.NavigateUrl = new TemplateFormat(this).GoUrl(Categorie);
            }
        }