public void ProcessRequest(HttpContext context) { context.Response.ContentType = "application/json"; StringBuilder result = new StringBuilder(); if (context.Request.Params["instrumentid"] == null || context.Request.Params["feeItem"] == null || context.Request.Params["feeType"] == null || context.Request.Params["feeStandard"] == null || context.Request.Params["remark"] == null) { result.Append("{result:false,msg:'参数错误!'}"); } else { try { Guid instrumentID = new Guid(context.Request.Params["instrumentid"]); string feeItem = context.Request.Params["feeItem"]; string feeType = context.Request.Params["feeType"]; string feeStandard = context.Request.Params["feeStandard"]; string remark = context.Request.Params["remark"]; CY.CSTS.Core.Business.INSTRFEE instrfee = new CY.CSTS.Core.Business.INSTRFEE { InstruId = instrumentID, FEEITEM = feeItem, FEECLASS = feeType, FEESTANDARD = feeStandard, REMARK = remark, }; instrfee.Save(); result.Append("{result:true,"); result.Append(string.Format("feeId:'{0}'", instrfee.Id)); result.Append(string.Format(",feeItem:'{0}'", instrfee.FEEITEM)); result.Append(string.Format(",feeType:'{0}'", instrfee.FEECLASS)); result.Append(string.Format(",feeStandard:'{0}'", instrfee.FEESTANDARD)); result.Append(string.Format(",remark:'{0}'", instrfee.REMARK)); result.Append("}"); } catch (Exception ex) { result = new StringBuilder(); result.Append("{result:false,msg:" + ex.Message + "}"); } } context.Response.Write(result); }
public static void ImportInstrumentFee() { try { ImportSqlServerUtility isql = new ImportSqlServerUtility(); string strsql = "select * from InstrFee"; DataSet ds = isql.ExecuteSqlDataSet(strsql); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Columns.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { CY.CSTS.Core.Business.INSTRFEE fee = new CY.CSTS.Core.Business.INSTRFEE(); fee.InstruId = TransferInstrumentId(ds.Tables[0].Rows[i][0].ToString()); fee.FEEITEM = ds.Tables[0].Rows[i][2].ToString(); fee.FEECLASS = ds.Tables[0].Rows[i][3].ToString(); fee.FEESTANDARD = ds.Tables[0].Rows[i][4].ToString(); fee.REMARK = ds.Tables[0].Rows[i][5].ToString(); fee.WRITEDATE = !string.IsNullOrEmpty(ds.Tables[0].Rows[i][6].ToString()) ? DateTime.Parse(ds.Tables[0].Rows[i][6].ToString()) : DateTime.MinValue; fee.UPDATEDATE = fee.WRITEDATE;//!string.IsNullOrEmpty(ds.Tables[0].Rows[i][7].ToString()) ? DateTime.Parse(ds.Tables[0].Rows[i][7].ToString()) : DateTime.MinValue; fee.Save(); } } } catch (Exception ex) { throw ex; } }
protected void BtnAddInstrument_Click(object sender, EventArgs e) { #region validation if (Request.Form["ddlCity"] != null && Request.Form["ddlCity"] != "0") { hdDdlCity.Value = Request.Form["ddlCity"];//把城市保留下来 } if (ddlMachineBigClass.SelectedValue != "0" && !string.IsNullOrEmpty(Request.Form["ddlMachineMiddleClass"]) && !string.IsNullOrEmpty(Request.Form["ddlMachineSmallClass"])) { hdMiddleClassID.Value = Request.Form["ddlMachineMiddleClass"];//仪器中类 hdSmallClassID.Value = Request.Form["ddlMachineSmallClass"];//仪器小类 } 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; //} if (string.IsNullOrEmpty(tbSpecific.Text.Trim())) { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script>alert('规格型号不能为空!');</script>"); tbSpecific.Focus(); 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.InstrumentCode instrumentCode = new CY.CSTS.Core.Business.InstrumentCode(); instrumentCode.Id = Guid.NewGuid(); instrumentCode.Save(); string unitTypeName = string.Empty; CY.CSTS.Core.Business.UnitInfo unitInfo = CY.CSTS.Core.Business.UnitInfo.Load(new Guid(hidUnit.Value.Trim())); CY.CSTS.Core.Business.UnitType unitType = CY.CSTS.Core.Business.UnitType.Load(unitInfo.UnitType); if (unitType == null) { unitTypeName = "科研单位"; } else { unitTypeName = unitType.Name; } #region 添加仪器基本信息 #region 添加仪器机组信息 Guid machinegroupid = default(Guid); if (tbSetName.Text != "") { CY.CSTS.Core.Business.MACHINESET machineSet = new CY.CSTS.Core.Business.MACHINESET { UnitID = (hidUnit.Value == "" || hidUnit.Value == null) ? Guid.Empty : new Guid(hidUnit.Value), LabID = (hidLab.Value == "" || hidLab.Value == null) ? Guid.Empty : new Guid(hidLab.Value), SetCode = tbInstrumentCode.Text.Trim(), SETNAME = tbSetName.Text, GroupInstance = tbGroupInstance.Text, EMAIL = tbEMAIL.Text, FAX = tbFAX.Text, LINKMAN = tbLinkMan.Text, PHONE = tbPHONE.Text, REMARK = tbMachineSetRemark.Text, WRITEDATE = System.DateTime.Now, UPDATEDATE = System.DateTime.Now }; machineSet.Save(); machinegroupid = machineSet.Id; } if (!machinegroupid.Equals(default(Guid))) { 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 = instrumentCode.Id, MachineGroupID = machinegroupid, UserID = userId }; machineGroupMember.Save(); } } } #endregion //添加仪器用途 string instrumentPurpose = string.Empty; 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 = instrumentCode.Id }; purpose.Save(); } } //添加仪器测试及研究领域 string instrumentDomain = string.Empty; 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 = instrumentCode.Id }; instrrealm.Save(); } } #region 添加仪器信息 switch (unitTypeName) { case "科研单位": CY.CSTS.Core.Business.INSTRUMENT instrument = new CY.CSTS.Core.Business.INSTRUMENT { ACCEPTMISSION = int.Parse(ddlAcceptMission.SelectedValue), ALIAS = tbAlias.Text, ASSESSOR = u.Name,//审核人 AUDITINGDATE = System.DateTime.Now, BUGETSOURCE = (ddlBudgeSource.SelectedValue == "0") ? Guid.Empty : new Guid(ddlBudgeSource.SelectedValue), SITE = new Guid(ddlProvince.SelectedValue), CITY = new Guid(Request.Form["ddlCity"]), COUNTRYCODE = (ddlCountry.SelectedValue == "0") ? Guid.Empty : new Guid(ddlCountry.SelectedValue), DISCARDTIME = (tbDisgardTime.Text == "") ? default(DateTime) : DateTime.Parse(tbDisgardTime.Text), ENAME = tbEnglishName.Text, EXAMINATION = (ddlExamination.SelectedValue == "0") ? Guid.Empty : new Guid(ddlExamination.SelectedValue), EXTERNALSERVICE = int.Parse(ddlExternalService.SelectedValue), FUNCTIONFEATURES = tbFunctionFeatures.Text, GETMODE = (ddlGetMode.SelectedValue == "0") ? Guid.Empty : new Guid(ddlGetMode.SelectedValue), GUIDELINE = tbGuidline.Text, HasCMA = int.Parse(ddlHasCMA.SelectedValue), HNAME = tbChineseName.Text, InstruCode = tbInstrumentCode.Text, IsSpecial = int.Parse(ddlIsSpecial.SelectedValue), LaboratoryId = (hidLab.Value == "" || hidLab.Value == null) ? Guid.Empty : new Guid(hidLab.Value), MachineGroupId = machinegroupid, MANUFACTURE = tbManufacturer.Text, NATIONALPAY = (tbNationalPay.Text == "") ? default(decimal) : decimal.Parse(tbNationalPay.Text), PERSONNELID = new Guid(hidPersonnal.Value), PRODUCEDATE = (tbProduceDate.Text == "") ? default(DateTime) : DateTime.Parse(tbProduceDate.Text), PRODUCESORT = (ddlProduceSort.SelectedValue == "0") ? Guid.Empty : new Guid(ddlProduceSort.SelectedValue), PRODUCINGAREA = tbProducingArea.Text, PURCHASEDATE = DateTime.Parse(tbPurchaseDate.Text), PURPOSEID = instrumentPurpose, REALMID = instrumentDomain, REMARK = tbRemark.Text, SPECTYPE = tbSpecific.Text, TOTALLY = int.Parse(ddlTotally.SelectedValue), UPDATEDATE = System.DateTime.Now, VALUERMB = decimal.Parse(tbValueRMB.Text), WorkingforUnitId = new Guid(hidUnit.Value), WRITEDATE = System.DateTime.Now, CLASSCODE = machineClass, Id = instrumentCode.Id, UseState = int.Parse(ddlUseState.SelectedValue), WorkState = int.Parse(ddlWorkState.SelectedValue), AUDITINGSTATE = 2, /**************添加采集盒状态****************/ Gather = !string.IsNullOrEmpty(ddlGather.SelectedValue) ? int.Parse(ddlGather.SelectedValue) : 0, }; instrument.Save(); SaveTag(instrument.Id); break; case "企业": CY.CSTS.Core.Business.EnterpriseInstrument enterpriseInstrument = new CY.CSTS.Core.Business.EnterpriseInstrument { ACCEPTMISSION = int.Parse(ddlAcceptMission.SelectedValue), ALIAS = tbAlias.Text, ASSESSOR = u.Name,// "load from session", AUDITINGDATE = System.DateTime.Now, BUGETSOURCE = (ddlBudgeSource.SelectedValue == "0") ? Guid.Empty : new Guid(ddlBudgeSource.SelectedValue), SITE = new Guid(ddlProvince.SelectedValue), CITY = new Guid(Request.Form["ddlCity"]), COUNTRYCODE = (ddlCountry.SelectedValue == "0") ? Guid.Empty : new Guid(ddlCountry.SelectedValue), DISCARDTIME = (tbDisgardTime.Text == "") ? default(DateTime) : DateTime.Parse(tbDisgardTime.Text), ENAME = tbEnglishName.Text, EXAMINATION = (ddlExamination.SelectedValue == "0") ? Guid.Empty : new Guid(ddlExamination.SelectedValue), EXTERNALSERVICE = int.Parse(ddlExternalService.SelectedValue), FUNCTIONFEATURES = tbFunctionFeatures.Text, GETMODE = (ddlGetMode.SelectedValue == "0") ? Guid.Empty : new Guid(ddlGetMode.SelectedValue), GUIDELINE = tbGuidline.Text, HasCMA = int.Parse(ddlHasCMA.SelectedValue), HNAME = tbChineseName.Text, InstruCode = tbInstrumentCode.Text, IsSpecial = int.Parse(ddlIsSpecial.SelectedValue), LaboratoryId = (hidLab.Value == "" || hidLab.Value == null) ? Guid.Empty : new Guid(hidLab.Value), MachineGroupId = machinegroupid, MANUFACTURE = tbManufacturer.Text, NATIONALPAY = (tbNationalPay.Text == "") ? default(decimal) : decimal.Parse(tbNationalPay.Text), PERSONNELID = new Guid(hidPersonnal.Value), PRODUCEDATE = (tbProduceDate.Text == "") ? default(DateTime) : DateTime.Parse(tbProduceDate.Text), PRODUCESORT = (ddlProduceSort.SelectedValue == "0") ? Guid.Empty : new Guid(ddlProduceSort.SelectedValue), PRODUCINGAREA = tbProducingArea.Text, PURCHASEDATE = DateTime.Parse(tbPurchaseDate.Text), PURPOSEID = instrumentPurpose, REALMID = instrumentDomain, REMARK = tbRemark.Text, SPECTYPE = tbSpecific.Text, TOTALLY = int.Parse(ddlTotally.SelectedValue), UPDATEDATE = System.DateTime.Now, VALUERMB = decimal.Parse(tbValueRMB.Text), WorkingforUnitId = new Guid(hidUnit.Value), WRITEDATE = System.DateTime.Now, CLASSCODE = machineClass, Id = instrumentCode.Id, UseState = int.Parse(ddlUseState.SelectedValue), WorkState = int.Parse(ddlWorkState.SelectedValue), AUDITINGSTATE = 2, Gather = !string.IsNullOrEmpty(ddlGather.SelectedValue) ? int.Parse(ddlGather.SelectedValue) : 0 }; enterpriseInstrument.Save(); SaveTag(enterpriseInstrument.Id); break; case "高校": CY.CSTS.Core.Business.UniversityInstrument universityInstrument = new CY.CSTS.Core.Business.UniversityInstrument { ACCEPTMISSION = int.Parse(ddlAcceptMission.SelectedValue), ALIAS = tbAlias.Text, ASSESSOR = u.Name,// "load from session", AUDITINGDATE = System.DateTime.Now, BUGETSOURCE = (ddlBudgeSource.SelectedValue == "0") ? Guid.Empty : new Guid(ddlBudgeSource.SelectedValue), SITE = new Guid(ddlProvince.SelectedValue), CITY = new Guid(Request.Form["ddlCity"]), COUNTRYCODE = (ddlCountry.SelectedValue == "0") ? Guid.Empty : new Guid(ddlCountry.SelectedValue), DISCARDTIME = (tbDisgardTime.Text == "") ? default(DateTime) : DateTime.Parse(tbDisgardTime.Text), ENAME = tbEnglishName.Text, EXAMINATION = (ddlExamination.SelectedValue == "0") ? Guid.Empty : new Guid(ddlExamination.SelectedValue), EXTERNALSERVICE = int.Parse(ddlExternalService.SelectedValue), FUNCTIONFEATURES = tbFunctionFeatures.Text, GETMODE = (ddlGetMode.SelectedValue == "0") ? Guid.Empty : new Guid(ddlGetMode.SelectedValue), GUIDELINE = tbGuidline.Text, HasCMA = int.Parse(ddlHasCMA.SelectedValue), HNAME = tbChineseName.Text, InstruCode = tbInstrumentCode.Text, IsSpecial = int.Parse(ddlIsSpecial.SelectedValue), LaboratoryId = (hidLab.Value == "" || hidLab.Value == null) ? Guid.Empty : new Guid(hidLab.Value), MachineGroupId = machinegroupid, MANUFACTURE = tbManufacturer.Text, NATIONALPAY = (tbNationalPay.Text == "") ? default(decimal) : decimal.Parse(tbNationalPay.Text), PERSONNELID = new Guid(hidPersonnal.Value), PRODUCEDATE = (tbProduceDate.Text == "") ? default(DateTime) : DateTime.Parse(tbProduceDate.Text), PRODUCESORT = (ddlProduceSort.SelectedValue == "0") ? Guid.Empty : new Guid(ddlProduceSort.SelectedValue), PRODUCINGAREA = tbProducingArea.Text, PURCHASEDATE = DateTime.Parse(tbPurchaseDate.Text), PURPOSEID = instrumentPurpose, REALMID = instrumentDomain, REMARK = tbRemark.Text, SPECTYPE = tbSpecific.Text, TOTALLY = int.Parse(ddlTotally.SelectedValue), UPDATEDATE = System.DateTime.Now, VALUERMB = decimal.Parse(tbValueRMB.Text), WorkingforUnitId = new Guid(hidUnit.Value), WRITEDATE = System.DateTime.Now, CLASSCODE = machineClass, Id = instrumentCode.Id, UseState = int.Parse(ddlUseState.SelectedValue), WorkState = int.Parse(ddlWorkState.SelectedValue), AUDITINGSTATE = 2, Gather = !string.IsNullOrEmpty(ddlGather.SelectedValue) ? int.Parse(ddlGather.SelectedValue) : 0 }; universityInstrument.Save(); SaveTag(universityInstrument.Id); break; default: break; } #endregion //添加仪器图片及视频信息 SaveFiles(instrumentCode.Id); SaveImg(instrumentCode.Id); #endregion #region 添加仪器附件信息 //添加仪器附件 string[] attachModel = Request.Form.GetValues("tbAttachmentModel"); string[] attachNum = Request.Form.GetValues("tbAttachmentNum"); string[] mainFunction = Request.Form.GetValues("tbMainFunction"); string[] attachName = Request.Form.GetValues("tbAttachmentName"); string[] attachPrice = Request.Form.GetValues("tbAttachmentPrice"); string[] attachManufacturer = Request.Form.GetValues("tbAttachmentManufacturer"); string[] attachRemark = Request.Form.GetValues("tbAttachRemark"); if (attachName.Length != 0) { for (int i = 0; i < attachName.Length; i++) { if (attachName[i] != "") { CY.CSTS.Core.Business.INSTRATTACHMENT attachment = new CY.CSTS.Core.Business.INSTRATTACHMENT { InstruId = instrumentCode.Id, ATTACHMENTNAME = attachName[i], //ATTACHMENTAMOUNT = int.Parse(attachNum[i]), //ATTACHMENTPRICE = decimal.Parse(attachPrice[i]), ATTACHMENTSPEC = attachModel[i], MANUFACTURER = attachManufacturer[i], PURPOSE = mainFunction[i], REMARK = attachRemark[i], WRITEDATE = System.DateTime.Now, UPDATEDATE = System.DateTime.Now }; attachment.Save(); } } } #endregion #region 添加仪器应用信息 string[] appDate = Request.Form.GetValues("tbApplicationDate"); string[] famousUser = Request.Form.GetValues("tbFamousUser"); string[] influentialNum = Request.Form.GetValues("tbInfluentialNum"); string[] trait = Request.Form.GetValues("tbTrait"); string[] appFruit = Request.Form.GetValues("tbApplicationFruit"); string[] appRemark = Request.Form.GetValues("tbApplicationRemark"); if (appDate.Length != 0) { for (int i = 0; i < appDate.Length; i++) { if (appDate[i] != "") { CY.CSTS.Core.Business.INSTRAPPLICATION application = new CY.CSTS.Core.Business.INSTRAPPLICATION { InstruId = instrumentCode.Id, YEAR = DateTime.Parse(appDate[i]), FAMOUSUSERS = famousUser[i], INFLUENTIALNUM = int.Parse(influentialNum[i]), FRUIT = appFruit[i], TRAIT = trait[i], REMARK = appRemark[i], WRITEDATE = System.DateTime.Now, UPDATEDATE = System.DateTime.Now }; application.Save(); } } } #endregion #region 添加仪器测试项目收费标准信息 string[] feeType = Request.Form.GetValues("tbFeeType"); string[] feeStandard = Request.Form.GetValues("tbFeeStandard"); string[] feeItem = Request.Form.GetValues("tbFeeItem"); string[] feeRemark = Request.Form.GetValues("tbFeeRemark"); if (feeItem.Length != 0) { for (int i = 0; i < feeItem.Length; i++) { if (feeItem[i] != "") { CY.CSTS.Core.Business.INSTRFEE instrfee = new CY.CSTS.Core.Business.INSTRFEE { InstruId = instrumentCode.Id, FEEITEM = feeItem[i], FEECLASS = feeType[i], FEESTANDARD = feeStandard[i], REMARK = feeRemark[i], WRITEDATE = System.DateTime.Now, UPDATEDATE = System.DateTime.Now }; instrfee.Save(); } } } #endregion #region 添加仪器服务信息 string[] outOffered = Request.Form.GetValues("ddlOutOffered"); string[] serivceType = Request.Form.GetValues("ddlSerivceType"); string[] serviceIncome = Request.Form.GetValues("tbServiceIncome"); string[] atlasName = Request.Form.GetValues("tbAtlasName"); string[] serviceExplain = Request.Form.GetValues("tbServiceExplain"); string[] offerTime = Request.Form.GetValues("tbOfferTime"); string[] testSampleNum = Request.Form.GetValues("tbTestSampleNum"); string[] atlasManufacturer = Request.Form.GetValues("tbAtlasManufacturer"); string[] serviceRemark = Request.Form.GetValues("tbServiceRemark"); if (outOffered.Length != 0) { for (int i = 0; i < outOffered.Length; i++) { if (offerTime[i] != "" && testSampleNum[i] != "") { CY.CSTS.Core.Business.INSTRSERVICE instrservice = new CY.CSTS.Core.Business.INSTRSERVICE { INSTRUMENTID = instrumentCode.Id, OUTOFFERED = int.Parse(outOffered[i]), SERVICECLASS = serivceType[i], OFFERTIME = int.Parse(offerTime[i]), ATLASMANUFACTURER = atlasManufacturer[i], ATLASNAME = atlasName[i], ServiceIncome = decimal.Parse(serviceIncome[i]), TestSampleNum = int.Parse(testSampleNum[i]), SERVICEEXPLAIN = serviceExplain[i], REMARK = serviceRemark[i], WRITEDATE = System.DateTime.Now, UPDATEDATE = System.DateTime.Now }; instrservice.Save(); } } } #endregion CY.CSTS.Core.Business.FreshNews fresh = new CY.CSTS.Core.Business.FreshNews(); fresh.Sponsor = "管理员"; fresh.FreshEvent = "添加仪器" + tbSetName.Text; if (tbEnglishName.Text.Trim() != "") { fresh.FreshEvent += "(" + tbEnglishName.Text + ")"; } fresh.Embracer = tbUnit.Text.Trim(); fresh.EmbracerId = new Guid(hidUnit.Value); fresh.UnitId = new Guid(hidUnit.Value); fresh.EventType = 3; fresh.EventTime = DateTime.Now; Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('添加成功!');window.location.href='InstrumentList.aspx';</script>"); } catch (Exception ex) { throw ex; } }