Example #1
0
    /// <summary>
    /// 响应责编完成按钮
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void OnFinishResponsible(object sender, EventArgs e)
    {
        //获取基础信息
        GeneralUser userResponsible = new GeneralUser();

        this.GetGeneralInfo(userResponsible);

        //添加责编到库
        if ((userResponsible.Id = UserManager.InsertGeneralUserReturnIndentity(userResponsible)) != 0)
        {
            //更新栏目
            for (int i = 0; i < this.CBLArticleColumn.Items.Count; i++)
            {
                if (this.CBLArticleColumn.Items[i].Selected)
                {
                    //搜出栏目 对象
                    int           columnId      = Convert.ToInt32(this.CBLArticleColumn.Items[i].Value);
                    ArticleColumn articleColumn = ArticleColumnManager.GetArticleColumnById(columnId);

                    //更新栏目对应责编
                    articleColumn.ResponsibelUserId = userResponsible.Id;
                    articleColumn.UserInfo_Name     = userResponsible.Name;
                    ArticleColumnManager.UpdateArticleColumn(articleColumn);
                }
            }
        }
        else
        {
            return;
        }

        //显示成功页面
        this.HideAllPanel();
        this.PanelSuccess.Visible = true;
    }
 /// <summary>
 /// 保存删除或修改栏目的信息
 /// </summary>
 /// <param name="source"></param>
 /// <param name="e"></param>
 protected void RepArticlec_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
     //删除操作
     if (e.CommandName == "Delete")
     {
         int id = int.Parse((e.Item.FindControl("btnDel") as LinkButton).CommandArgument.ToString());
         ArticleColumnManager.DeleteArticleColumn(id);
         DataBing_();
     }
     //修改栏目信息
     else if (e.CommandName == "Update")
     {
         lblColumn.Text = "修改栏目信息";
         int           id = int.Parse(((e.Item.FindControl("btnUpdate")) as LinkButton).CommandArgument.ToString());
         ArticleColumn ac = ArticleColumnManager.GetArticleColumnById(id);
         if (ac == null)
         {
             return;
         }
         txtName.Text   = ac.Name;
         txtDepict.Text = ac.Description;
         DropName.Text  = ac.ResponsibelUserId.ToString();
         lblId.Text     = ac.Id.ToString();
     }
     //删除所选项栏目信息
     else if (e.CommandName == "DeleteAll")
     {
         for (int i = 0; i < RepArticlec.Items.Count; i++)
         {
             int id;
             if ((RepArticlec.Items[i].FindControl("chb") as CheckBox).Checked)
             {
                 id = int.Parse((RepArticlec.Items[i].FindControl("ArticleColumn_ID") as Label).Text);
                 ArticleColumnManager.DeleteArticleColumn(id);
             }
         }
         DataBing_();
     }
 }