Beispiel #1
0
 public void btnSave_Click(object sender, EventArgs e)
 {
     Maticsoft.BLL.Tao.Categories CateBll = new Maticsoft.BLL.Tao.Categories();
     Model.Tao.Categories CateModel = new Model.Tao.Categories();
     CateModel.Name = this.txtCategoryName.Text;
     CateModel.Description = txtPageDesc.Text;
     //修改之前先删除以前的ICO
     int CategoryId = (Convert.ToInt32(Request.Params["CategoryId"]));
     CateModel.CategoryId = CategoryId;
     Model.Tao.Categories Val = CateBll.GetModel(CategoryId);
     if (Val.IconUrl != null)
     {
         HiUploader.DeleteImage(Val.IconUrl);
     }
     if (this.fileUpload.HasFile)
     {
         try
         {
             CateModel.IconUrl = HiUploader.UploadCategoryImage(fileUpload.PostedFile);
         }
         catch
         {
             return;
         }
     }
     CateBll.UpdateCategory(CateModel);
     Response.Redirect("list.aspx");
 }
Beispiel #2
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     string target = this.listTarget.SelectedValue;
     int parentid = int.Parse(target);
     Model.Tao.Categories CateModel = new Model.Tao.Categories();
     int path = CateBll.GetMaxId();
     CateModel.Name = this.txtCategoryName.Text;
     CateModel.Description = TextBox1.Text;
     if (parentid == 0)
     {
         CateModel.ParentCategoryId = 0;
     }
     else
     {
         CateModel.ParentCategoryId = Convert.ToInt32(this.listTarget.SelectedValue);
     }
     if (this.fileUpload.HasFile)
     {
         try
         {
             CateModel.IconUrl = HiUploader.UploadCategoryImage(fileUpload.PostedFile);
         }
         catch
         {
             return;
         }
     }
     CateBll.AddNewCate(CateModel);
     string selectVa = this.listTarget.SelectedValue;
     BiudTree();
     this.listTarget.SelectedValue = selectVa;
     MessageBox.Show(this, "保存成功!");
 }