Exemplo n.º 1
0
 protected void btn_add_Click(object sender, EventArgs e)
 {
     if (Request.QueryString["id"] != null)
     {
         zs.Model.Tbl_Xueyuan model = bll.GetModel(int.Parse(Request.QueryString["id"].ToString()));
         model.name   = this.tb_name.Text;
         model.nameen = this.tb_nameen.Text;
         //model.yuanzhang = this.ASPxHtmlEditor_yuanzhang.Html;
         model.conts = Server.HtmlDecode(hd_jianjie.Value);
         jianjie     = model.conts;
         if (fu_logo.HasFile)
         {
             model.logo = UploadImage(fu_logo);
         }
         if (fu_image1.HasFile)
         {
             model.image1 = UploadImage(fu_image1);
         }
         if (fu_image2.HasFile)
         {
             model.image2 = UploadImage(fu_image2);
         }
         if (fu_image3.HasFile)
         {
             model.image3 = UploadImage(fu_image3);
         }
         bll.Update(model);
         this.Label1.Text = "修改成功!";
     }
     else
     {
         zs.Model.Tbl_Xueyuan model = new zs.Model.Tbl_Xueyuan();
         model.name   = this.tb_name.Text;
         model.nameen = this.tb_nameen.Text;
         //model.yuanzhang = this.ASPxHtmlEditor_yuanzhang.Html;
         //model.conts = this.ASPxHtmlEditor_conts.Html;
         model.conts = Server.HtmlDecode(hd_jianjie.Value);
         jianjie     = model.conts;
         if (fu_logo.HasFile)
         {
             model.logo = UploadImage(fu_logo);
         }
         if (fu_image1.HasFile)
         {
             model.image1 = UploadImage(fu_image1);
         }
         if (fu_image2.HasFile)
         {
             model.image2 = UploadImage(fu_image2);
         }
         if (fu_image3.HasFile)
         {
             model.image3 = UploadImage(fu_image3);
         }
         if (string.IsNullOrEmpty(model.name))
         {
             this.Label1.Text = "信息不完整!";
             return;
         }
         bll.Add(model);
         this.Label1.Text = "保存成功!";
     }
 }