/// <summary> /// 获取单个模板的配置信(服务端) /// </summary> /// <param name="ModelID"></param> /// <returns></returns> public List<JZTestConfig> GetConfigJson(string ModelID,Boolean IsServer) { if (_ListJzTestConfig == null) { _ListJzTestConfig = new List<JZTestConfig>(); } else { _ListJzTestConfig.Clear(); } String Sql_Select = "select * from sys_module_config where ModuleID='" + ModelID.ToUpper() + "' order by SerialNumber;"; DataTable dt = Agent.CallRemoteService("Yqun.BO.LoginBO.dll", "GetDataTable", new object[] { Sql_Select }) as DataTable; if (dt != null && dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { JZTestConfig tempJZTestConfig = new JZTestConfig(); tempJZTestConfig.ModuleID = new Guid(dt.Rows[i]["ModuleID"].ToString()); tempJZTestConfig.SerialNumber = Int32.Parse(dt.Rows[i]["SerialNumber"].ToString()); tempJZTestConfig.Config = JsonToObject<List<JZTestCell>>(dt.Rows[i]["Config"].ToString()); _ListJzTestConfig.Add(tempJZTestConfig); } } return _ListJzTestConfig; }
/// <summary> /// 获取单个模板的配置信(本地) /// </summary> /// <param name="ModelID"></param> /// <returns></returns> public List<JZTestConfig> GetConfigJson(string ModelID) { if (_ListJzTestConfig == null) { _ListJzTestConfig = new List<JZTestConfig>(); } else { _ListJzTestConfig.Clear(); } DataTable dt = _SqlLocalHlper.GetDataTable("select * from sys_module_config where ModuleID='" + ModelID.ToUpper() + "' order by SerialNumber;"); if (dt != null && dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { JZTestConfig tempJZTestConfig = new JZTestConfig(); tempJZTestConfig.ModuleID = new Guid(dt.Rows[i]["ModuleID"].ToString()); tempJZTestConfig.SerialNumber = Int32.Parse(dt.Rows[i]["SerialNumber"].ToString()); tempJZTestConfig.Config = JsonToObject<List<JZTestCell>>(dt.Rows[i]["Config"].ToString()); _ListJzTestConfig.Add(tempJZTestConfig); } } return _ListJzTestConfig; }
private void ButtonOk_Click(object sender, EventArgs e) { Int32 deviceType = 0; List <JZTestConfig> list = new List <JZTestConfig>(); if (rb_ylj.Checked) { deviceType = 1; for (int i = 0; i < sheetView1.Rows.Count; i++) { Cell rowCell = sheetView1.Cells[i, 2]; JZTestConfig c = new JZTestConfig(); c.ModuleID = moduleID; c.SerialNumber = Convert.ToInt32(sheetView1.Cells[i, 1].Value); c.Config = new List <JZTestCell>(); if (rowCell.Value != null && rowCell.Value.ToString().Trim() != "") { JZTestCell cell = new JZTestCell(); cell.Name = JZTestEnum.PHHZ; cell.CellName = sheetView1.Cells[i, 2].Value.ToString(); cell.SheetID = new Guid(sheetView1.Cells[i, 2].Tag.ToString()); c.Config.Add(cell); list.Add(c); } } } else if (rb_wnj.Checked) { deviceType = 2; for (int i = 0; i < SheetView2.Rows.Count; i++) { Cell rowCell = SheetView2.Cells[i, 2]; JZTestConfig c = new JZTestConfig(); c.ModuleID = moduleID; c.SerialNumber = Convert.ToInt32(SheetView2.Cells[i, 1].Value); c.Config = new List <JZTestCell>(); JZTestCell cell = null; if (rowCell.Value != null && rowCell.Value.ToString().Trim() != "") { cell = new JZTestCell(); cell.Name = JZTestEnum.QFL; cell.CellName = SheetView2.Cells[i, 2].Value.ToString(); cell.SheetID = new Guid(SheetView2.Cells[i, 2].Tag.ToString()); c.Config.Add(cell); } rowCell = SheetView2.Cells[i, 4]; if (rowCell.Value != null && rowCell.Value.ToString().Trim() != "") { cell = new JZTestCell(); cell.Name = JZTestEnum.LDZDL; cell.CellName = SheetView2.Cells[i, 4].Value.ToString(); cell.SheetID = new Guid(SheetView2.Cells[i, 4].Tag.ToString()); c.Config.Add(cell); } rowCell = SheetView2.Cells[i, 6]; if (rowCell.Value != null && rowCell.Value.ToString().Trim() != "") { cell = new JZTestCell(); cell.Name = JZTestEnum.DHBJ; cell.CellName = SheetView2.Cells[i, 6].Value.ToString(); cell.SheetID = new Guid(SheetView2.Cells[i, 6].Tag.ToString()); c.Config.Add(cell); } list.Add(c); } } String json = Newtonsoft.Json.JsonConvert.SerializeObject(list); ModuleHelperClient.UpdateModuleConfigInfo(moduleID, json, cb_active.Checked, deviceType); staParent.BindModelList(); this.Close(); }