Ejemplo n.º 1
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(tbTitle.Text.Trim()))
     {
         Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('标题不能为空');</script>");
         tbTitle.Focus();
         return;
     }
     else if (ddlBig.SelectedValue == "0")
     {
         Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('请选择版块');</script>");
         ddlBig.Focus();
         return;
     }
     else
     {
         int t = 0;
         HttpFileCollection files = HttpContext.Current.Request.Files;
         if (files.Count == 0 || files[0].ContentLength == 0 || files[0].FileName == "")
         {
             t = 2;//没有
         }
         else
         {
             t = 1;
         }
         Guid pID = new Guid();
         if (ddlBig.SelectedValue != "0")
         {
             if (Request.Form["ddlSub"] != "0" && Request.Form["ddlSub"] != null)
             {
                 pID = new Guid(Request.Form["ddlSub"].ToString());
             }
             else
             {
                 pID = new Guid(ddlBig.SelectedValue.ToString());
             }
         }
         CY.CSTS.Core.Business.VirtualLabDataSon vss = new CY.CSTS.Core.Business.VirtualLabDataSon();
         vss.Content = fck.Value;
         vss.Name = tbTitle.Text.Trim();
         vss.AddPerson = u.Name;
         vss.AddTime = DateTime.Now;
         vss.FrontID = pID;
         vss.HasAnnex = t;
         vss.Save();
         if (t == 1)
         {
             //SaveAnnex(2, vss.Id);
         }
         Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('保存成功');window.location.href='newsList.aspx'</script>");
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 保存
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(tbTitle.Text.Trim()))
     {
         Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('标题不能为空');</script>");
         tbTitle.Focus();
         return;
     }
     else
     {
         int t = 0;
         HttpFileCollection files = HttpContext.Current.Request.Files;
         if (files.Count == 0 || files[0].ContentLength == 0 || files[0].FileName == "")
         {
             t = 2;//没有
         }
         else
         {
             t = 1;
         }
         Guid amid = new Guid();
         if (!string.IsNullOrEmpty(hdTemp.Value))
         {
             amid = new Guid(hdTemp.Value);
         }
         else
         {
             amid = id;
         }
         CY.CSTS.Core.Business.VirtualLabDataSon vs = CY.CSTS.Core.Business.VirtualLabDataSon.Load(amid);
         if (vs != null)
         {
             vs.Content = fck.Value;
             vs.Name = tbTitle.Text.Trim();
             vs.AddPerson = u.Name;
             vs.AddTime = DateTime.Now;
             vs.HasAnnex = t;
             vs.Save();
             if (t == 1)
             {
                 //SaveAnnex(1, vs.Id);
             }
         }
         else
         {
             CY.CSTS.Core.Business.VirtualLabDataSon vss = new CY.CSTS.Core.Business.VirtualLabDataSon();
             vss.Content = fck.Value;
             vss.Name = tbTitle.Text.Trim();
             vss.AddPerson = u.Name;
             vss.AddTime = DateTime.Now;
             vss.FrontID = new Guid(hdTemp.Value);
             vss.HasAnnex = t;
             vss.Save();
             if (t == 1)
             {
                 //SaveAnnex(2, vss.Id);
             }
         }
         if (!string.IsNullOrEmpty(hdTopID.Value))
         {
             //Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('保存成功!');window.location.href='LabBigInfo.aspx?ID="+ hdTopID.Value + "&frontID="+hdID.Value+"'</script>");
             Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('保存成功!');</script>");
         }
         else if (!string.IsNullOrEmpty(hdTemp.Value))
         {
             //Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('保存成功!');window.location.href='LabBigInfo.aspx?ID=" + hdTemp.Value + "&frontID=" + hdID.Value + "'</script>");
             Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('保存成功!');</script>");
         }
     }
 }