Esempio n. 1
0
 protected void Bind()
 {
     if (Request.QueryString["id"] != null)
     {
         if (Tools.TryParseMethod(Request.QueryString["id"].ToString()) != 0)
         {
             NewsCategoryInfo info = ncBLL.getAllById(id);
             if (info.nc_fatherid != 0)
             {
                 lbcategory.Text = ncBLL.getAllById(info.nc_id).nc_name;
             }
             lbName.Text    = info.nc_name;
             lbSorting.Text = info.nc_sorting.ToString();
             img1.ImageUrl  = Tools.GetAppSettings("NewsImageTruePath") + info.nc_image;
             if (info.nc_show)
             {
                 lbShow.Text = "顯示";
             }
             else
             {
                 lbShow.Text = "不顯示";
             }
         }
     }
 }
Esempio n. 2
0
    public string getTitle(int id)
    {
        if (id == 0)
        {
            return("此為主類別");
        }
        NewsCategoryInfo info = ncBLL.getAllById(id);

        return(info.nc_name);
    }
Esempio n. 3
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     if (!Directory.Exists(Server.MapPath("NewsImageTruePath")))
     {
         System.IO.Directory.CreateDirectory(Server.MapPath("~/ImageCollection/news/"));
     }
     if (ncBLL.SearchHierarchyDownVail(Tools.TryParseMethod(ddlCategory.SelectedValue), id, int.Parse(UserInfoConfig.GetUserConfig("HierarchyNewsCategory"))))
     {
         if (hfImg.Value != Image1.AlternateText)
         {
             FileInfo file = new FileInfo(Server.MapPath(Image1.ImageUrl));
             file.CopyTo(Server.MapPath(Tools.GetAppSettings("NewsImageTruePath") + Image1.AlternateText));
             if (File.Exists(Server.MapPath(Tools.GetAppSettings("NewsImageTruePath") + hfImg.Value)))
             {
                 File.Delete(Server.MapPath(Tools.GetAppSettings("NewsImageTruePath") + hfImg.Value));
             }
         }
         NewsCategoryInfo info = ncBLL.getAllById(id);
         info.nc_fatherid = Tools.TryParseMethod(ddlCategory.SelectedValue);
         info.nc_name     = txtName.Text;
         info.nc_show     = bool.Parse(rbShow.SelectedValue);
         info.nc_image    = Image1.AlternateText;
         if (ncBLL.Update(info) > 0)
         {
             Response.Redirect("List.aspx?header=修改訊息完成!", true);
         }
         else
         {
             ShowMessage("更新失敗: 更新類別不可為自身、不可為自身以下的子類別");
         }
     }
     else
     {
         ShowMessage("轉換類別超越階層限制數");
     }
 }