protected void BtnSaveEdit_Click(object sender, EventArgs e) { #region validation if (string.IsNullOrEmpty(tbInstrumentCode.Text)) { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('仪器编号不能为空!');</script>"); return; } if (string.IsNullOrEmpty(tbUnit.Text) || string.IsNullOrEmpty(hidUnit.Value) || !CY.Utility.Common.StringHelper.IsGuid(hidUnit.Value)) { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('单位不能为空!');</script>"); return; } if (string.IsNullOrEmpty(tbPersonnal.Text) || string.IsNullOrEmpty(hidPersonnal.Value) || !CY.Utility.Common.StringHelper.IsGuid(hidPersonnal.Value)) { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('仪器负责人不能为空!');</script>"); return; } if (string.IsNullOrEmpty(tbChineseName.Text)) { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('仪器中文名称不能为空!');</script>"); return; } if (string.IsNullOrEmpty(tbValueRMB.Text)) { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('仪器原值不能为空!');</script>"); return; } if (string.IsNullOrEmpty(tbPurchaseDate.Text)) { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('购进日期不能为空!');</script>"); return; } string machineClass = string.Empty; if (ddlMachineBigClass.SelectedValue != "0" && !string.IsNullOrEmpty(Request.Form["ddlMachineMiddleClass"]) && !string.IsNullOrEmpty(Request.Form["ddlMachineSmallClass"])) { machineClass = Request.Form["ddlMachineSmallClass"]; } else { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('仪器分类编号不能为空!');</script>"); return; } if (string.IsNullOrEmpty(ddlProvince.SelectedValue) || ddlProvince.SelectedValue.Equals("0") || !CY.Utility.Common.StringHelper.IsGuid(ddlProvince.SelectedValue)) { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('仪器所在省不能为空'!);</script>"); return; } if (string.IsNullOrEmpty(Request.Form["ddlCity"]) || Request.Form["ddlCity"].Equals("0") || !CY.Utility.Common.StringHelper.IsGuid(Request.Form["ddlCity"])) { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('仪器所在市不能为空!');</script>"); return; } //if (string.IsNullOrEmpty(ddlGetMode.SelectedValue) || ddlGetMode.SelectedValue.Equals("0") || !CY.Utility.Common.StringHelper.IsGuid(ddlGetMode.SelectedValue)) //{ // Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('获取方式不能为空!');</script>"); // return; //} //if (string.IsNullOrEmpty(ddlWorkState.SelectedValue) || ddlWorkState.SelectedValue.Equals("0")) //{ // Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('运行状态不能为空!');</script>"); // return; //} //if (string.IsNullOrEmpty(ddlUseState.SelectedValue) || ddlUseState.SelectedValue.Equals("0")) //{ // Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('使用状态不能为空!');</script>"); // return; //} //if (string.IsNullOrEmpty(ddlCountry.SelectedValue) || ddlCountry.SelectedValue.Equals("0") || !CY.Utility.Common.StringHelper.IsGuid(ddlCountry.SelectedValue)) //{ // Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('国别不能为空!');</script>"); // return; //} //if (string.IsNullOrEmpty(ddlProduceSort.SelectedValue) || ddlProduceSort.SelectedValue.Equals("0") || !CY.Utility.Common.StringHelper.IsGuid(ddlProduceSort.SelectedValue)) //{ // Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('仪器产区类别不能为空!');</script>"); // return; //} //if (string.IsNullOrEmpty(ddlBudgeSource.SelectedValue) || ddlBudgeSource.SelectedValue.Equals("0") || !CY.Utility.Common.StringHelper.IsGuid(ddlBudgeSource.SelectedValue)) //{ // Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('仪器购置经费来源不能为空!');</script>"); // return; //} //if (string.IsNullOrEmpty(ddlExamination.SelectedValue) || ddlExamination.SelectedValue.Equals("0") || !CY.Utility.Common.StringHelper.IsGuid(ddlExamination.SelectedValue)) //{ // Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('仪器检定情况不能为空!');</script>"); // return; //} //if (string.IsNullOrEmpty(ddlHasCMA.SelectedValue) || ddlHasCMA.SelectedValue.Equals("0")) //{ // Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('是否计量认证不能为空!');</script>"); // return; //} //if (string.IsNullOrEmpty(ddlIsSpecial.SelectedValue) || ddlIsSpecial.SelectedValue.Equals("0")) //{ // Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('是否特色仪器不能为空!');</script>"); // return; //} //if (string.IsNullOrEmpty(ddlTotally.SelectedValue) || ddlTotally.SelectedValue.Equals("0")) //{ // Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('是否愿意共用不能为空!');</script>"); // return; //} //if (string.IsNullOrEmpty(ddlAcceptMission.SelectedValue) || ddlAcceptMission.SelectedValue.Equals("0")) //{ // Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('是否接受任务不能为空!');</script>"); // return; //} //if (string.IsNullOrEmpty(ddlExternalService.SelectedValue) || ddlExternalService.SelectedValue.Equals("0")) //{ // Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('是否对外服务不能为空!');</script>"); // return; //} decimal temp = default(decimal); if (!decimal.TryParse(tbValueRMB.Text.Trim(), out temp)) { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('仪器原值不是数字!');</script>"); return; } if (tbNationalPay.Text != "") { if (!decimal.TryParse(tbNationalPay.Text.Trim(), out temp)) { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('国拨经费不是数字!');</script>"); return; } } DateTime tempDate = default(DateTime); if (tbDisgardTime.Text != "") { if (!DateTime.TryParse(tbDisgardTime.Text, out tempDate)) { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('报废年限格式不对!');</script>"); return; } } if (tbProduceDate.Text != "") { if (!DateTime.TryParse(tbProduceDate.Text, out tempDate)) { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('生产日期格式不对!');</script>"); return; } } if (!DateTime.TryParse(tbPurchaseDate.Text, out tempDate)) { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('购进日期格式不对!');</script>"); return; } if (!string.IsNullOrEmpty(tbLab.Text) && !string.IsNullOrEmpty(hidLab.Value)) { if (!CY.Utility.Common.StringHelper.IsGuid(hidLab.Value)) { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('所属实验室输入有误!');</script>"); return; } } if (string.IsNullOrEmpty(tbSetName.Text)) { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('机组名称不能为空!');</script>"); return; } //if (!string.IsNullOrEmpty(tbMachineGroup.Text) && !string.IsNullOrEmpty(hidMachineGroup.Value)) //{ // if (!CY.Utility.Common.StringHelper.IsGuid(hidMachineGroup.Value)) // { // Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('所属机组输入有误!');</script>"); // return; // } //} #endregion try { CY.CSTS.Core.Business.view_INSTRUMENT instrument = CY.CSTS.Core.Business.view_INSTRUMENT.Load(InstrumentID); if (instrument != null) { #region 添加仪器基本信息 //修改仪器用途 string instrumentPurpose = string.Empty; List<CY.CSTS.Core.Business.PURPOSE> purposelist = CY.CSTS.Core.Business.PURPOSE.GetPurposeDynamic(" [InstruId]='" + InstrumentID + "'", "") as List<CY.CSTS.Core.Business.PURPOSE>; foreach (CY.CSTS.Core.Business.PURPOSE p in purposelist) { p.DeleteOnSave(); p.Save(); } for (int i = 0; i < cblPurpose.Items.Count; i++) { if (cblPurpose.Items[i].Selected) { instrumentPurpose += cblPurpose.Items[i].Text; CY.CSTS.Core.Business.PURPOSE purpose = new CY.CSTS.Core.Business.PURPOSE { PURPOSEID = new Guid(cblPurpose.Items[i].Value), InstruId = instrument.Id }; purpose.Save(); } } //修改仪器测试及研究领域 string instrumentDomain = string.Empty; List<CY.CSTS.Core.Business.INSTRREALM> realmlist = CY.CSTS.Core.Business.INSTRREALM.GetInstrrealmDynamic(" [InstruId]='" + InstrumentID + "'", "") as List<CY.CSTS.Core.Business.INSTRREALM>; foreach (CY.CSTS.Core.Business.INSTRREALM rel in realmlist) { rel.DeleteOnSave(); rel.Save(); } for (int i = 0; i < cblRealm.Items.Count; i++) { if (cblRealm.Items[i].Selected) { instrumentDomain += cblRealm.Items[i].Text; CY.CSTS.Core.Business.INSTRREALM instrrealm = new CY.CSTS.Core.Business.INSTRREALM { DomainId = new Guid(cblRealm.Items[i].Value), InstruId = instrument.Id }; instrrealm.Save(); } } //修改仪器信息 instrument.ACCEPTMISSION = int.Parse(ddlAcceptMission.SelectedValue); instrument.ALIAS = tbAlias.Text; instrument.AUDITINGDATE = System.DateTime.Now; instrument.BUGETSOURCE = (ddlBudgeSource.SelectedValue == "0") ? Guid.Empty : new Guid(ddlBudgeSource.SelectedValue); instrument.SITE = new Guid(ddlProvince.SelectedValue); instrument.CITY = new Guid(Request.Form["ddlCity"]); instrument.COUNTRYCODE = (ddlCountry.SelectedValue == "0") ? Guid.Empty : new Guid(ddlCountry.SelectedValue); instrument.DISCARDTIME = (tbDisgardTime.Text == "") ? default(DateTime) : DateTime.Parse(tbDisgardTime.Text); instrument.ENAME = tbEnglishName.Text; instrument.EXAMINATION = (ddlExamination.SelectedValue == "0") ? Guid.Empty : new Guid(ddlExamination.SelectedValue); instrument.EXTERNALSERVICE = int.Parse(ddlExternalService.SelectedValue); instrument.FUNCTIONFEATURES = tbFunctionFeatures.Text; instrument.GETMODE = (ddlGetMode.SelectedValue == "0") ? Guid.Empty : new Guid(ddlGetMode.SelectedValue); instrument.GUIDELINE = tbGuidline.Text; instrument.HasCMA = int.Parse(ddlHasCMA.SelectedValue); instrument.HNAME = tbChineseName.Text; instrument.InstruCode = tbInstrumentCode.Text; instrument.IsSpecial = int.Parse(ddlIsSpecial.SelectedValue); instrument.LaboratoryId = (hidLab.Value == "" || hidLab.Value == null) ? Guid.Empty : new Guid(hidLab.Value); instrument.MANUFACTURE = tbManufacturer.Text; instrument.NATIONALPAY = (tbNationalPay.Text == "") ? default(decimal) : decimal.Parse(tbNationalPay.Text); instrument.PERSONNELID = new Guid(hidPersonnal.Value); instrument.PRODUCEDATE = (tbProduceDate.Text == "") ? default(DateTime) : DateTime.Parse(tbProduceDate.Text); instrument.PRODUCESORT = (ddlProduceSort.SelectedValue == "0") ? Guid.Empty : new Guid(ddlProduceSort.SelectedValue); instrument.PRODUCINGAREA = tbProducingArea.Text; instrument.PURCHASEDATE = DateTime.Parse(tbPurchaseDate.Text); instrument.PURPOSEID = instrumentPurpose; instrument.REALMID = instrumentDomain; instrument.REMARK = tbRemark.Text; instrument.SPECTYPE = tbSpecific.Text; instrument.TOTALLY = int.Parse(ddlTotally.SelectedValue); instrument.UPDATEDATE = System.DateTime.Now; instrument.VALUERMB = decimal.Parse(tbValueRMB.Text); instrument.WorkingforUnitId = new Guid(hidUnit.Value); instrument.WRITEDATE = System.DateTime.Now; instrument.CLASSCODE = machineClass; instrument.UseState = int.Parse(ddlUseState.SelectedValue); instrument.WorkState = int.Parse(ddlWorkState.SelectedValue); try { instrument.Gather = !string.IsNullOrEmpty(ddlGather.SelectedValue) ? int.Parse(ddlGather.SelectedValue) : 0; } catch { } //改变仪器状态 //申请入网状态无修改功能(state=3时) switch (instrument.AUDITINGSTATE) { case 1: instrument.AUDITINGSTATE = 1; break; case 2: instrument.AUDITINGSTATE = 2; break; case 4: instrument.AUDITINGSTATE = 4; break; case 5: instrument.AUDITINGSTATE = 5; break; case 6: instrument.AUDITINGSTATE = 6; break; case 7: instrument.AUDITINGSTATE = 7; break; case 8: instrument.AUDITINGSTATE = 4; break; case 9: instrument.AUDITINGSTATE = 4; break; case 10: instrument.AUDITINGSTATE = 4; break; case 11: instrument.AUDITINGSTATE = 4; break; default: instrument.AUDITINGSTATE = 1; break; } instrument.Save(); //保存修改的仪器图片及视频信息 SaveFiles(instrument.Id); SaveImg(instrument.Id); #endregion #region 修改仪器机组信息 CY.CSTS.Core.Business.MACHINESET machineSet = CY.CSTS.Core.Business.MACHINESET.Load(instrument.MachineGroupId); //机组已存在 if (machineSet != null) { machineSet.UnitID = new Guid(hidUnit.Value); machineSet.LabID = (hidLab.Value == "" || hidLab.Value == null) ? Guid.Empty : new Guid(hidLab.Value); machineSet.SETNAME = tbSetName.Text; machineSet.GroupInstance = tbGroupInstance.Text; machineSet.EMAIL = tbEMAIL.Text; machineSet.FAX = tbFAX.Text; machineSet.LINKMAN = tbLinkMan.Text; machineSet.PHONE = tbPHONE.Text; machineSet.REMARK = tbMachineSetRemark.Text; machineSet.WRITEDATE = System.DateTime.Now; machineSet.UPDATEDATE = System.DateTime.Now; machineSet.SetCode = tbInstrumentCode.Text.Trim(); machineSet.Save(); string[] machineSetUser = Request.Form.GetValues("mgperson"); List<CY.CSTS.Core.Business.MachineGroupMember> mgMember = CY.CSTS.Core.Business.MachineGroupMember.SelectMachineGroupMembersByAndMachineGroupID(machineSet.Id) as List<CY.CSTS.Core.Business.MachineGroupMember>; List<string> tempMachineSetUser = new List<string>(); if (machineSetUser != null && machineSetUser.Count() > 0) { tempMachineSetUser = machineSetUser.ToList(); } //将重复的机组人员ID去掉 if (tempMachineSetUser != null && tempMachineSetUser.Count > 0) { if (mgMember.Count != 0) { foreach (CY.CSTS.Core.Business.MachineGroupMember m in mgMember) { for (int i = 0; i < machineSetUser.Length; i++) { if (m.UserID == new Guid(machineSetUser[i])) { tempMachineSetUser.Remove(machineSetUser[i]); } } } } } if (tempMachineSetUser.Count != 0) { for (int i = 0; i < tempMachineSetUser.Count; i++) { Guid userId = new Guid(tempMachineSetUser[i]); CY.CSTS.Core.Business.MachineGroupMember machineGroupMember = new CY.CSTS.Core.Business.MachineGroupMember { InstruID = instrument.Id, MachineGroupID = machineSet.Id, UserID = userId }; machineGroupMember.Save(); } } } else//机组不存在 { if (!string.IsNullOrEmpty(tbSetName.Text)) { CY.CSTS.Core.Business.MACHINESET machinegroup = new CY.CSTS.Core.Business.MACHINESET(); machinegroup.UnitID = new Guid(hidUnit.Value); machinegroup.LabID = (hidLab.Value == "" || hidLab.Value == null) ? Guid.Empty : new Guid(hidLab.Value); machinegroup.GroupInstance = tbGroupInstance.Text; machinegroup.EMAIL = tbEMAIL.Text; machinegroup.FAX = tbFAX.Text; machinegroup.LINKMAN = tbLinkMan.Text; machinegroup.PHONE = tbPHONE.Text; machinegroup.REMARK = tbMachineSetRemark.Text; machinegroup.WRITEDATE = System.DateTime.Now; machinegroup.UPDATEDATE = System.DateTime.Now; machinegroup.SETNAME = tbSetName.Text; machinegroup.SetCode = tbInstrumentCode.Text.Trim(); machinegroup.Save(); instrument.MachineGroupId = machinegroup.Id; instrument.Save(); if (machinegroup.Id != null && machinegroup.Id != Guid.Empty) { string[] machineSetUser = Request.Form.GetValues("mgperson"); if (machineSetUser != null && machineSetUser.Length != 0) { for (int i = 0; i < machineSetUser.Length; i++) { Guid userId = new Guid(machineSetUser[i]); CY.CSTS.Core.Business.MachineGroupMember machineGroupMember = new CY.CSTS.Core.Business.MachineGroupMember { InstruID = instrument.Id, MachineGroupID = machinegroup.Id, UserID = userId }; machineGroupMember.Save(); } } } } } #endregion /*Tag*/ if (!string.IsNullOrEmpty(tbTag.Text.Trim())) { string tagTemp = tbTag.Text.Trim(); if (tagTemp.Contains(",")) { tagTemp = tagTemp.Replace(",", ","); } else if (tagTemp.Contains(" ")) { tagTemp = tagTemp.Replace(" ", ","); } CY.CSTS.Core.Business.Tag tag = CY.CSTS.Core.Business.Tag.SelectTagsDynamic(" ContentID='" + instrument.Id + "'", ""); if (tag != null) { tag.TagName = tagTemp; tag.Save(); } else { CY.CSTS.Core.Business.Tag tagCore = new CY.CSTS.Core.Business.Tag(); tagCore.ContentType = 1; tagCore.ContentID = instrument.Id; tagCore.TagName = tagTemp; tagCore.Save(); } } } Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('修改仪器信息成功!');window.location.href='InstrumentInfo.aspx?Id=" + InstrumentID + "';</script>"); } catch (Exception ex) { throw ex; } }
protected void btnSave_Click(object sender, EventArgs e) { string lawId = Context.Request.QueryString["OperId"]; string LawSortId = Context.Request.QueryString["OperType"]; string strErr = ""; try { CY.CSTS.Core.Business.InstrumentoperateRepository lawRepository; if (lawId != null && lawId != "") { Guid id = new Guid(lawId); lawRepository = CY.CSTS.Core.Business.InstrumentoperateRepository.Load(id); } else { lawRepository = new CY.CSTS.Core.Business.InstrumentoperateRepository(); } if (tbTitle.Text.Trim() == "") { strErr = "名称不能为空<br>"; } if (hdInstrumentId.Value == "" || hdInstrumentId.Value == null) { strErr += "必须选择所属仪器<br>"; } if (tbContent.Value == "") { strErr += "内容不能为空"; } if (strErr != "") { lbErr.Text = strErr; return; } lawRepository.Head = tbTitle.Text.Trim(); lawRepository.Remark = tbRemark.Text.Trim(); Guid insId = new Guid(hdInstrumentId.Value); lawRepository.InstrumentID = insId; lawRepository.OperateContent = Server.HtmlEncode(tbContent.Value); lawRepository.DranscribeDate = System.DateTime.Now; //仪器 lawRepository.DranscriberID = U.Id; try { Guid lawSortId = new Guid(ddlLawSort.SelectedValue); lawRepository.OperateSortID = lawSortId; hdSortId.Value = "" + ddlLawSort.SelectedValue + ""; } catch (Exception ex) { lbErr.Text = ex.ToString(); } lawRepository.Save(); /*Tag*/ if (!string.IsNullOrEmpty(tbTag.Text.Trim())) { string tagTemp = tbTag.Text.Trim(); if (tagTemp.Contains(",")) { tagTemp = tagTemp.Replace(",", ","); } else if(tagTemp.Contains(" ")) { tagTemp = tagTemp.Replace(" ",","); } CY.CSTS.Core.Business.Tag tag = new CY.CSTS.Core.Business.Tag(); tag.ContentID = lawRepository.Id; tag.TagName = tagTemp; tag.ContentType = 2;//信息 tag.Save(); } lbErr.Text = "保存成功"; Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('保存成功');window.location.href='InstrumentoperateRepositoryManagement.aspx?OperSort=" + hdSortId.Value + "';</script>"); BindDetail(); } catch (Exception ex) { lbErr.Text = ex.ToString(); } }
protected void btnSave_Click(object sender, EventArgs e) { string lawId = Context.Request.QueryString["LawId"]; string LawSortId = Context.Request.QueryString["LawType"]; string strErr = ""; try { CY.CSTS.Core.Business.LawRepository lawRepository; if (lawId != null&&lawId!="") { Guid id = new Guid(lawId); lawRepository = CY.CSTS.Core.Business.LawRepository.Load(id); } else { lawRepository = new CY.CSTS.Core.Business.LawRepository(); } if (tbTitle.Text.Trim() == "") { strErr = "标题不能为空<br>"; } if (tbContent.Value == "") { strErr += "内容不能为空"; } if (strErr != "") { lbErr.Text = strErr; return; } lawRepository.Head = tbTitle.Text.Trim(); lawRepository.Subhead = tbSubHead.Text.Trim(); lawRepository.PublishDate = DateTime.Parse(tbPubDate.Text); lawRepository.EffectiveDate = DateTime.Parse(tbEffDate.Text); lawRepository.Publisher = tbPublisher.Text.Trim(); lawRepository.Remark = tbRemark.Text.Trim(); lawRepository.Content = Server.HtmlEncode(tbContent.Value); lawRepository.DranscribeDate = System.DateTime.Now; lawRepository.DranscriberID = U.Id; lawRepository.LawNumber = tbLawCode.Text.Trim(); try { Guid lawSortId = new Guid(ddlLawSort.SelectedValue); lawRepository.LawSortID = lawSortId; hdSortId.Value = "" + ddlLawSort.SelectedValue + ""; } catch (Exception ex) { lbErr.Text = ex.ToString(); } try { Guid tradeSortId = new Guid(ddlTradeSort.SelectedValue); lawRepository.TradeSortID = tradeSortId; } catch (Exception ex) { } lawRepository.Save(); /*Tag*/ if (!string.IsNullOrEmpty(tbTag.Text.Trim())) { string tagTemp = tbTag.Text.Trim(); if (tagTemp.Contains(",")) { tagTemp = tagTemp.Replace(",", ","); } else if (tagTemp.Contains(" ")) { tagTemp = tagTemp.Replace(" ", ","); } CY.CSTS.Core.Business.Tag tag = new CY.CSTS.Core.Business.Tag(); tag.ContentID = lawRepository.Id; tag.TagName = tagTemp; tag.ContentType = 2;//信息 tag.Save(); } Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('保存成功');window.location.href='LawManagement.aspx?LawSort="+hdSortId.Value+"';</script>"); BindDetail(); } catch (Exception ex) { } }
private void SaveTag(Guid contentID, string tagName) { /*Tag*/ if (!string.IsNullOrEmpty(tagName.Trim())) { string tagT = tagName.Trim(); if (tagT.Contains(",")) { tagT = tagT.Replace(",", ","); } else if (tagT.Contains(" ")) { tagT = tagT.Replace(" ", ","); } CY.CSTS.Core.Business.Tag tagCore = new CY.CSTS.Core.Business.Tag(); tagCore.ContentID = contentID; tagCore.TagName = tagT; tagCore.ContentType = 2; tagCore.Save(); } }
private void ModifyTag(Guid contentID, string tagName) { if (!string.IsNullOrEmpty(tagName.Trim())) { string tagT = tagName.Trim(); if (tagT.Contains(",")) { tagT = tagT.Replace(",", ","); } else if (tagT.Contains(" ")) { tagT = tagT.Replace(" ", ","); } CY.CSTS.Core.Business.Tag tagCore = CY.CSTS.Core.Business.Tag.SelectTagsDynamic(" ContentID='" + contentID + "'", ""); if (tagCore != null) { tagCore.TagName = tagT; tagCore.Save(); } else { CY.CSTS.Core.Business.Tag tagS = new CY.CSTS.Core.Business.Tag(); tagS.ContentID = contentID; tagS.ContentType = 2; tagS.TagName = tagT; tagS.Save(); } } }
/*Tag*/ private void SaveTag(Guid contentID) { if (!string.IsNullOrEmpty(tbTag.Text.Trim())) { string tagTemp = tbTag.Text.Trim(); if (tagTemp.Contains(",")) { tagTemp = tagTemp.Replace(",", ","); } else if (tagTemp.Contains(" ")) { tagTemp = tagTemp.Replace(" ", ","); } CY.CSTS.Core.Business.Tag tag = new CY.CSTS.Core.Business.Tag(); tag.TagName = tagTemp; tag.ContentID = contentID; tag.ContentType = 1; tag.Save(); } }
protected void btnSave_Click(object sender, EventArgs e) { string ManuId = lbManuId.Text; string ManuSortId = Context.Request.QueryString["SortId"]; string strErr = ""; try { CY.CSTS.Core.Business.ManufacturerRepository manufacturerRepository; if (ManuId != null && ManuId != "") { Guid id = new Guid(ManuId); manufacturerRepository = CY.CSTS.Core.Business.ManufacturerRepository.Load(id); } else { manufacturerRepository = new CY.CSTS.Core.Business.ManufacturerRepository(); } if (tbName.Text.Trim() == "") { strErr = "名称不能为空<br>"; } if (tbContent.Value == "") { strErr += "简介不能为空"; } if (strErr != "") { lbErr.Text = strErr; return; } manufacturerRepository.Name = tbName.Text.Trim(); manufacturerRepository.Address = tbAddress.Text.Trim(); manufacturerRepository.Postalcode = tbPostalcode.Text.Trim(); manufacturerRepository.Tel = tbTel.Text.Trim(); manufacturerRepository.Fax = tbFax.Text.Trim(); manufacturerRepository.Website = tbWebsite.Text.Trim(); manufacturerRepository.Email = tbEmail.Text.Trim(); manufacturerRepository.Linkman = tbLinkman.Text.Trim(); manufacturerRepository.MainProduct = tbMainProduct.Text.Trim(); manufacturerRepository.MainFranchiser = tbMainFranchiser.Text.Trim(); manufacturerRepository.Synopsis = Server.HtmlEncode(tbContent.Value); manufacturerRepository.DranscribeDate = System.DateTime.Now; manufacturerRepository.ManufacturerSort = int.Parse(hdenSort.Value); manufacturerRepository.DranscriberID = U.Id; try { Guid lawSortId = new Guid(ddlManuSort.SelectedValue); manufacturerRepository.EnterpriseSortID = lawSortId; hdSortId.Value = "" + ddlManuSort.SelectedValue + ""; } catch (Exception ex) { lbErr.Text = ex.ToString(); } try { Guid tradeSortId = new Guid(ddlTradeSort.SelectedValue); manufacturerRepository.TradeSortID = tradeSortId; } catch (Exception ex) { lbErr.Text = ex.ToString(); } manufacturerRepository.Save(); /*Tag*/ if (!string.IsNullOrEmpty(tbTag.Text.Trim())) { string tagTemp = tbTag.Text.Trim(); if (tagTemp.Contains(",")) { tagTemp = tagTemp.Replace(",", ","); } else if (tagTemp.Contains(" ")) { tagTemp = tagTemp.Replace(" ", ","); } CY.CSTS.Core.Business.Tag tag = new CY.CSTS.Core.Business.Tag(); tag.ContentID = manufacturerRepository.Id; tag.TagName = tagTemp; tag.ContentType = 2;//信息 tag.Save(); } SaveFiles(manufacturerRepository.Id); SaveImgs(manufacturerRepository.Id); Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('保存成功');window.location.href='ManufacturerRepositoryManagement.aspx?Sort=" + hdSortId.Value + "&ManufacturerSort=" + hdenSort.Value + "';</script>"); BindDetail(); } catch (Exception ex) { lbErr.Text = ex.ToString(); } }