Ejemplo n.º 1
0
 public void ProcessRequest(HttpContext context)
 {
     context.Response.ContentType = "application/json";
     string result = string.Empty;
     if (context.Request.Params["name"] == null)
     {
         result = "{success:false,msg:'名称不能为空'}";
     }
     else if (context.Request.Params["labID"] == null)
     {
         result = "{success:false,msg:'ID不能为空'}";
     }
     else
     {
         try
         {
             string name = context.Request.Params["name"].ToString();
             Guid id = new Guid(context.Request.Params["labID"].ToString());
             CY.CSTS.Core.Business.VirtualLabDataBigClass vb = new CY.CSTS.Core.Business.VirtualLabDataBigClass();
             vb.Name = name;
             vb.VirturlLabID = id;
             vb.Save();
             result = "{success:true}";
         }
         catch (Exception ex)
         {
             result = "{success:false,msg:'"+ex.Message+"'}";
         }
     }
     context.Response.Write(result);
 }
Ejemplo n.º 2
0
 protected void btnAdd_Click(object sender, EventArgs e)
 {
     try
     {
         if (string.IsNullOrEmpty(tbName.Text.Trim()))
         {
             Page.ClientScript.RegisterClientScriptBlock(this.GetType(),"","<script>alert('名称不能为空');</script>");
             tbName.Focus();
             return;
         }
         CY.CSTS.Core.Business.VirtualLaboratory vl = new CY.CSTS.Core.Business.VirtualLaboratory();
         vl.Name = tbName.Text.Trim();
         vl.Content = fck.Value;
         vl.Save();
         CY.CSTS.Core.Business.VirtualLabDataBigClass vb = new CY.CSTS.Core.Business.VirtualLabDataBigClass();
         vb.Name = "虚拟实验室";
         vb.VirturlLabID = vl.Id;
         vb.Save();
         CY.CSTS.Core.Business.VirtualLabDataBigClass vb2 = new CY.CSTS.Core.Business.VirtualLabDataBigClass();
         vb2.VirturlLabID = vl.Id;
         vb2.Name = "分析常识";
         vb2.Save();
         CY.CSTS.Core.Business.VirtualLabDataBigClass vb3 = new CY.CSTS.Core.Business.VirtualLabDataBigClass();
         vb3.VirturlLabID = vl.Id;
         vb3.Name = "实验室架构";
         vb3.Save();
         Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('新增成功');window.location.href='VirtualLabList.aspx'</script>");
     }
     catch (Exception ex)
     {
         Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert(" + ex.Message + ");</script>");
     }
 }