/// <summary> /// 删除 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnDel_Click(object sender, EventArgs e) { try { CheckBox cb; Lab lab; for (int i = 0; i < gvLabInfo.Rows.Count; i++) { cb = (CheckBox)gvLabInfo.Rows[i].FindControl("chb"); if (cb.Checked) { Guid id = new Guid(gvLabInfo.DataKeys[i].Value.ToString()); lab = Lab.Load(id); if (lab != null) { CY.CSTS.Core.Business.FreshNews fresh = new CY.CSTS.Core.Business.FreshNews(); CY.CSTS.Core.Business.User user = Session["User"] as CY.CSTS.Core.Business.User; fresh.Sponsor = user.Name; fresh.Embracer = lab.UnitName; fresh.UnitId = lab.UnitID; fresh.EventTime = DateTime.Now; fresh.FreshEvent = "删除实验室" + lab.Name; fresh.EventType = 5; lab.DeleteOnSave(); lab.Save(); } } } BindgvLabInfo(); Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "删除成功!", "<script>alert('删除成功');window.location.href='LabManage.aspx'</script>"); } catch (Exception ex) { lbErr.Text = ex.Message; } }
/// <summary> /// 删除仪器信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void BtnDelete_Click(object sender, EventArgs e) { try { CY.CSTS.Core.Business.InstrumentCode instrument = CY.CSTS.Core.Business.InstrumentCode.Load(InstrumentID); CY.CSTS.Core.Business.view_INSTRUMENT view = CY.CSTS.Core.Business.view_INSTRUMENT.Load(InstrumentID); if (instrument != null) { instrument.DeleteOnSave(); instrument.Save(); /*Tag*/ CY.CSTS.Core.Business.Tag tag = CY.CSTS.Core.Business.Tag.SelectTagsDynamic(" ContentID='" + InstrumentID + "'", ""); if (tag != null) { tag.DeleteOnSave(); tag.Save(); } DeleteAnnex(InstrumentID); CY.CSTS.Core.Business.FreshNews fresh = new CY.CSTS.Core.Business.FreshNews(); CY.CSTS.Core.Business.User user = Session["User"] as CY.CSTS.Core.Business.User; fresh.Sponsor = user.Name; fresh.FreshEvent = "删除仪器" + view.HNAME; if (view.ENAME != null && view.ENAME != "") { fresh.FreshEvent += "(" + view.ENAME + ")"; } fresh.Embracer = view.WorkingforUnitName; fresh.UnitId = view.WorkingforUnitId; fresh.EventType = 5; fresh.EventTime = DateTime.Now; } Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "删除", "<script>alert('仪器删除成功!');window.location.href='InstrumentList.aspx';</script>"); } catch { Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "删除", "<script>alert('删除失败!')</script>"); return; } }
/// <summary> /// 申请入网 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void BtnApply_Click(object sender, EventArgs e) { try { CY.CSTS.Core.Business.view_INSTRUMENT instrument = CY.CSTS.Core.Business.view_INSTRUMENT.Load(InstrumentID); CY.CSTS.Core.Business.FreshNews fresh = new CY.CSTS.Core.Business.FreshNews(); CY.CSTS.Core.Business.User user = Session["User"] as CY.CSTS.Core.Business.User; fresh.Sponsor = user.Name; fresh.Embracer = instrument.HNAME; if (instrument.ENAME != null && instrument.ENAME != "") { fresh.Embracer += instrument.ENAME; } fresh.UnitId = instrument.WorkingforUnitId; fresh.EventTime = DateTime.Now; if (instrument != null) { switch (instrument.AUDITINGSTATE) { case 1: instrument.AUDITINGSTATE = CY.Utility.Common.CodeInterface.InstrumentState.Applying.State; instrument.UPDATEDATE = System.DateTime.Now; instrument.Save(); break; case 2: instrument.AUDITINGSTATE = CY.Utility.Common.CodeInterface.InstrumentState.Applying.State; instrument.UPDATEDATE = System.DateTime.Now; instrument.Save(); break; case 5: instrument.AUDITINGSTATE = CY.Utility.Common.CodeInterface.InstrumentState.Applying.State; instrument.UPDATEDATE = System.DateTime.Now; instrument.Save(); break; default: break; } } Response.Redirect("InstrumentInfo.aspx?ID=" + InstrumentID.ToString(), true); } catch (Exception ex) { throw ex; } }
protected void BtOpen_Click(object sender, EventArgs e) { CY.CSTS.Core.Business.StimulationCheck stimulition = new CY.CSTS.Core.Business.StimulationCheck(); if (CY.CSTS.Core.Business.StimulationCheck.HasOpenCheck()) { //Response.Write("<script>alert('已经存在开启的激励,无法开启')</script>"); Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "opendednow", "<script type='text/javascript'>alert('已经存在开启的激励,无法开启')</script>"); } else { stimulition.State = 2; SaveStimulition(stimulition, 2); } CY.CSTS.Core.Business.FreshNews fresh = new CY.CSTS.Core.Business.FreshNews(); fresh.Sponsor = ""; fresh.FreshEvent = "激励考评开始"; fresh.Embracer = ""; fresh.EmbracerId = new Guid(); fresh.UnitId = new Guid(); fresh.EventType = 6; fresh.EventTime = DateTime.Now; }
protected void btnSave_Click(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(tbNameEdit.Text.Trim())) { lbErr.Text = "实验室名称不能为空"; tbNameEdit.Focus(); } else { string express = "\\w{1,}@\\w{1,}\\.\\w{1,}"; System.Text.RegularExpressions.Regex myRegex = new System.Text.RegularExpressions.Regex(express); bool suc = myRegex.IsMatch(tbEmailEdit.Text.Trim()); if (!suc) { lbErr.Text = "请输入正确的邮箱格式"; tbEmailEdit.Focus(); return; } Lab lab = Lab.Load(gloalID); lab.Name = tbNameEdit.Text.Trim(); lab.OtherName1 = tbOtherNameEdit.Text.Trim(); lab.OtherName2 = tbOtherName2Edit.Text.Trim(); lab.Address = tbAddressEdit.Text.Trim(); lab.Postalcode = tbPostEdit.Text.Trim(); lab.Tel = tbTelEdit.Text.Trim(); lab.Fax = tbFaxEdit.Text.Trim(); lab.Website = tbWebSiteEdit.Text.Trim(); lab.Email = tbEmailEdit.Text.Trim(); lab.LabSortID = new Guid(ddllevelSortEdit.SelectedValue.ToString()); lab.LabLevelID = new Guid(ddllevelEdit.SelectedValue.ToString()); lab.LabPrincipal = tbPrincipalEdit.Text.Trim(); lab.LinkMan = tbLinkManEdit.Text.Trim(); lab.IsRecognize = radioY.Checked == true ? 1 : 2; lab.RecognizeNumber = tbRecognizeNumberEdit.Text.Trim(); lab.OrganizationCode = tbOrganizationCodeEdit.Text.Trim(); lab.Synopsis = tbSynopsisEdit.Text.Trim(); lab.Remark = tbRemarkEdit.Text.Trim(); lab.Save(); string labDom = hdDomID.Value; if (!string.IsNullOrEmpty(labDom)) { List<LabDomain> labDomainlist = LabDomain.SelectLabDomainsByAndLabID(gloalID) as List<LabDomain>; if (labDomainlist != null) { if (labDomainlist.Count > 0) { for (int d = 0; d < labDomainlist.Count; d++) { LabDomain labD = LabDomain.Load(labDomainlist[d].Id); labD.DeleteOnSave(); labD.Save(); } } string[] domIDTemp = labDom.Split(','); for (int j = 0; j < domIDTemp.Count(); j++) { string domID = domIDTemp[j]; LabDomain labDomSave = new LabDomain(); labDomSave.LabID = gloalID; labDomSave.DomainID = new Guid(domID); labDomSave.Save(); } } } CY.CSTS.Core.Business.FreshNews fresh = new CY.CSTS.Core.Business.FreshNews(); CY.CSTS.Core.Business.User user = Session["User"] as CY.CSTS.Core.Business.User; fresh.Sponsor = user.Name; fresh.FreshEvent = "修改信息"; fresh.Embracer = lab.Name; fresh.UnitId = lab.UnitID; fresh.EventType = 8; fresh.EventTime = DateTime.Now; Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('修改成功');window.location.href='Detail.aspx?id=" + gloalID + "'</script>"); } } catch (Exception ex) { lbErr.Text = ex.Message; } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "application/json"; string result = string.Empty; if(context.Request.Params["tbLabName"]==null) { result="{success:false,msg:'不能为空'}"; } else { try { Lab lab=new Lab(); lab.Name=context.Request.Params["tbLabName"].ToString(); lab.UnitID=new Guid(context.Request.Params["UnitID"].ToString()); lab.OtherName1=context.Request.Params["tbOtherName1"].ToString(); lab.OtherName2=context.Request.Params["tbOtherName2"].ToString(); lab.Address=context.Request.Params["tbAddress"].ToString(); lab.Postalcode=context.Request.Params["tbPostalcode"].ToString(); lab.Tel=context.Request.Params["tbTel"].ToString(); lab.Fax=context.Request.Params["tbFax"].ToString(); lab.Website=context.Request.Params["tbWebsite"].ToString(); lab.Email=context.Request.Params["tbEmail"].ToString(); lab.LabSortID=new Guid(context.Request.Params["ddlLabSort"].ToString()); lab.LabLevelID=new Guid(context.Request.Params["ddlLabLevel"].ToString()); lab.LabPrincipal=context.Request.Params["tbLabPrincipal"].ToString(); lab.LinkMan=context.Request.Params["tbLinkMan"].ToString(); lab.IsRecognize=int.Parse(context.Request.Params["tbRecognize"].ToString()); lab.RecognizeNumber=context.Request.Params["tbRecognizeNumber"].ToString(); lab.OrganizationCode=context.Request.Params["tbOrganizationCode"].ToString(); lab.Synopsis=context.Request.Params["tbSynopsis"].ToString(); lab.Remark=context.Request.Params["tbRemark"].ToString(); lab.Save(); CY.CSTS.Core.Business.FreshNews fresh = new CY.CSTS.Core.Business.FreshNews(); fresh.Sponsor = "管理员"; fresh.FreshEvent = "添加实验室" + lab.Name; CY.CSTS.Core.Business.UnitInfo unitinfo = CY.CSTS.Core.Business.UnitInfo.Load(lab.UnitID); fresh.Embracer = unitinfo.UnitName; fresh.UnitId = lab.UnitID; fresh.EventType = 8; fresh.EventTime = DateTime.Now; string domIDtemp = context.Request.Params["tbDomainID"]; if (!string.IsNullOrEmpty(domIDtemp)) { string[] domID=domIDtemp.Split(','); if (domID.Length > 0) { for (int m = 0; m < domID.Length; m++) { LabDomain labDomain = new LabDomain(); labDomain.LabID = lab.Id; labDomain.DomainID =new Guid(domID[m]); labDomain.Save(); } } } result = "{success:true}"; } catch(Exception ex) { result="{success:false,msg:'"+ex.Message+"'}"; } } context.Response.Write(result); }