コード例 #1
0
        protected void lvTheme_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            string themeId = (lvTheme.Items[(e.Item.DataItemIndex)].FindControl("themeId") as HtmlInputHidden).Value.Trim();

            if (e.CommandName == "Link")//点击主题标题链接时触发
            {
                Model.Theme theme = new Model.Theme()
                {
                    ThemeId = themeId
                };
                if (theme.IsError)
                {
                    Msg = "参数格式错误";
                    printMsgToClient();
                    return;
                }
                ThemeManagement.Click(theme.ThemeId);
                Response.Redirect("~/ThemeDisplay.aspx?themeId=" + themeId + "&path=" + lblPath.Text);
            }
            if (e.CommandName == "Del")
            {
                Msg = CollectThemeManagement.UncollectTheme(Convert.ToString(Session["memberId"]), themeId);
                printMsgToClient();
                Bind();
            }
        }
コード例 #2
0
        /// <summary>
        /// Deletes the theme.
        /// </summary>
        /// <param name="theme">The theme.</param>
        public static void DeleteTheme(Theme theme)
        {
            if (theme==null||theme.Id< 1)
                throw new CustomException("Invalid theme argument","Can`t delete this argument");

            Theme.Delete(theme);
            Context.SaveChanges();
        }
コード例 #3
0
        /// <summary>
        /// Adds the theme.
        /// </summary>
        /// <param name="theme">The theme.</param>
        public static void AddTheme(Theme theme)
        {
            if (theme==null||
                 string.IsNullOrEmpty(theme.Title) ||
                 string.IsNullOrEmpty(theme.GroupName) ||
                 theme.FieldId == 0)
               throw new CustomException("Invalid theme argument","Can`t add this value");

            Theme.Add(theme);
            Context.SaveChanges();
        }
コード例 #4
0
ファイル: CriticismSet.aspx.cs プロジェクト: coderhardly/BBS
 protected void btnSelect_Click(object sender, EventArgs e)
 {
     if (ddlKey.SelectedValue == "所有")
     {
         Bind();
         return;
     }
     if (ddlKey.SelectedValue == "主题")
     {
         Theme theme = new Model.Theme()
         {
             ThemeId = txtKey.Text.Trim()
         };
         if (theme.IsError)
         {
             Msg = "参数格式错误";
             SomeMethod.PrintMsgToClient(this.ClientScript, Msg);
             return;
         }
         Bind(CriticismManagement.SelectByThemeId(theme.ThemeId));
         return;
     }
     if (ddlKey.SelectedValue == "会员")
     {
         Member member = new Member()
         {
             MemberId = txtKey.Text.Trim()
         };
         if (member.IsError)
         {
             Msg = "参数格式错误";
             SomeMethod.PrintMsgToClient(this.ClientScript, Msg);
             return;
         }
         Bind(CriticismManagement.SeleteByMemberId(member.MemberId));
         return;
     }
     if (ddlKey.SelectedValue == "编号")
     {
         Criticism criticism = new Criticism()
         {
             CriticismId = txtKey.Text.Trim()
         };
         if (criticism.IsError)
         {
             Msg = "参数格式错误";
             SomeMethod.PrintMsgToClient(this.ClientScript, Msg);
             return;
         }
         Bind(CriticismManagement.SelectByCriticismId(criticism.CriticismId));
         return;
     }
 }
コード例 #5
0
 protected void lvTheme_ItemCommand(object sender, ListViewCommandEventArgs e)
 {
     if (e.CommandName == "Link")//点击主题标题链接时触发
     {
         string      themeId = (lvTheme.Items[(e.Item.DataItemIndex)].FindControl("themeId") as HtmlInputHidden).Value.Trim();
         Model.Theme theme   = new Model.Theme()
         {
             ThemeId = themeId
         };
         if (theme.IsError)
         {
             Msg = "参数格式错误";
             printMsgToClient();
             return;
         }
         ThemeManagement.Click(theme.ThemeId);
         Response.Redirect("~/ThemeDisplay.aspx?themeId=" + themeId + "&path=" + lblDivisionName.Text.Trim());
     }
 }