public int AddData(int x, int y, int width, int height, double size) { string cmdText = "insert into RegUnitInfo(size,GlobalPosX,GlobalPosY,Width,Height) Values('" + size + "','" + x + "','" + y + "','" + width + "','" + height + "')"; op.ExecuteNonQuery(cmdText, CommandType.Text, null); DataTable dataTable = op.ExecuteDataTable("select id,size,GlobalPosX,GlobalPosY,Width,Height from RegUnitInfo", CommandType.Text, null); CtcVo ctcVo = new CtcVo(); ctcVo.index = dataTable.Rows[dataTable.Rows.Count - 1]["id"].ToString(); ctcVo.GlobalPosX = x; ctcVo.GlobalPosY = y; ctcVo.Width = width; ctcVo.Height = height; ctcVo.Size = Math.Round(size, 2).ToString(); listvo.Add(ctcVo); DgList.ItemsSource = null; DgList.ItemsSource = listvo; return(int.Parse(ctcVo.index)); }
public void BinData() { DataTable dataTable = op.ExecuteDataTable("select id,size,GlobalPosX,GlobalPosY,Width,Height from RegUnitInfo", CommandType.Text, null); listvo = new List <CtcVo>(); for (int i = 0; i < dataTable.Rows.Count; i++) { CtcVo ctcVo = new CtcVo(); ctcVo.index = dataTable.Rows[i]["id"].ToString(); ctcVo.ImageSource = null; ctcVo.GlobalPosX = int.Parse(dataTable.Rows[i]["GlobalPosX"].ToString()); ctcVo.GlobalPosY = int.Parse(dataTable.Rows[i]["GlobalPosY"].ToString()); ctcVo.Width = int.Parse(dataTable.Rows[i]["Width"].ToString()); ctcVo.Height = int.Parse(dataTable.Rows[i]["Height"].ToString()); ctcVo.Size = dataTable.Rows[i]["Size"].ToString(); ctcVo.Diagnosis = "无诊断"; listvo.Add(ctcVo); } DgList.ItemsSource = listvo; }
private void RadioButton_Checked(object sender, RoutedEventArgs e) { if (DgList.SelectedItem == null) { return; } RadioButton radioButton = (RadioButton)sender; CtcVo ctcVo = (CtcVo)DgList.SelectedItem; if (CheckList.Contains(ctcVo)) { int index = CheckList.IndexOf(ctcVo); CheckList[index].CheckValue = radioButton.Tag.ToString(); } else { ctcVo.CheckValue = radioButton.Tag.ToString(); CheckList.Add(ctcVo); } int num = 0; int num2 = 0; for (int i = 0; i < CheckList.Count; i++) { string checkValue = CheckList[i].CheckValue; if (checkValue == "1") { num++; } else if (checkValue == "2") { num2++; } else { CheckList.Remove(ctcVo); } } txt_qzsl.Text = num2.ToString(); txt_xssl.Text = num.ToString(); }