/// <summary> /// 实例化查询结果 /// </summary> /// <param Name="tempds"></param> /// <returns></returns> private static Class_Datacodecs[] GetSelectDirectionary(DataSet tempds) { if (tempds != null) { if (tempds.Tables[0].Rows.Count > 0) { Class_Datacodecs[] Directionary = new Class_Datacodecs[tempds.Tables[0].Rows.Count]; for (int i = 0; i < tempds.Tables[0].Rows.Count; i++) { Directionary[i] = new Class_Datacodecs(); Directionary[i].Id = tempds.Tables[0].Rows[i]["ID"].ToString(); Directionary[i].Name = tempds.Tables[0].Rows[i]["NAME"].ToString(); Directionary[i].Code = tempds.Tables[0].Rows[i]["CODE"].ToString(); Directionary[i].Shortchut_code = tempds.Tables[0].Rows[i]["SHORTCUT_CODE"].ToString(); Directionary[i].Enable = tempds.Tables[0].Rows[i]["ENABLE"].ToString(); Directionary[i].Type = tempds.Tables[0].Rows[i]["TYPE"].ToString(); } return(Directionary); } else { return(null); } } else { return(null); } }
/// <summary> /// 添加 /// </summary> /// <param Name="sender"></param> /// <param Name="e"></param> private void btnAdd_Click(object sender, EventArgs e) { trvDictionary.SelectedNode = null; selectDirectionary = null; isSave = true; Edit(isSave); }
/// <summary> /// 把数据显示到表格 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void trvDictionary_Click(object sender, EventArgs e) { if (trvDictionary.SelectedNode != null) { if (trvDictionary.SelectedNode.Tag.GetType().ToString().Contains("Class_Datacodecs")) { selectDirectionary = (Class_Datacodecs)trvDictionary.SelectedNode.Tag; iniEditData(selectDirectionary); } } }
private void trvDictionary_AfterSelect(object sender, TreeViewEventArgs e) { if (groupBox1.Enabled && !isSave) { if (trvDictionary.SelectedNode != null) { if (trvDictionary.SelectedNode.Tag.GetType().ToString().Contains("Class_Datacodecs")) { selectDirectionary = (Class_Datacodecs)trvDictionary.SelectedNode.Tag; iniEditData(selectDirectionary); } } } }
/// <summary> /// 刷新 /// </summary> private void RefleshFrm() { txtName.Enabled = false; txtCode.Enabled = false; radYes.Enabled = false; radNo.Enabled = false; txtPinyin.Enabled = false; cmbType.Enabled = false; btnAdd.Enabled = true; btnModify.Enabled = true; btnSave.Enabled = false; btnCancel.Enabled = false; selectDirectionary = null; trvDictionary.SelectedNode = null; groupBox1.Enabled = true; isSave = false; }
private void iniEditData(Class_Datacodecs temp) { if (temp != null) { txtCode.Text = temp.Code; txtName.Text = temp.Name; txtPinyin.Text = temp.Shortchut_code; mark = temp.Enable; if (mark == "Y") { radYes.Checked = true; radNo.Checked = false; } else { radNo.Checked = true; radYes.Checked = false; } cmbType.SelectedValue = temp.Type; } }