private void btnSave_Click(object sender, EventArgs e) { try { if (currentSick != null) { //清空原有关系 if (currentSick != null) { App.ExecuteSQL("delete T_SECTION_AREA where SAID='" + currentSick.Said + "'"); } //设置现有关系 for (int i = 0; i < lvRelation.Items.Count; i++) { if (lvRelation.Items[i].Tag.GetType().ToString().Contains("Class_Sections")) { Class_Sections temp = (Class_Sections)lvRelation.Items[i].Tag; App.ExecuteSQL("insert into T_SECTION_AREA(id,SID,SAID) values(" + App.GenId().ToString() + "," + temp.Sid.ToString() + "," + currentSick.Said.ToString() + ")"); } } App.Msg("操作成功!"); } else { App.Msg("请先选择病区!"); } } catch (Exception ex) { App.Msg("操作失败,原因:" + ex.ToString() + ""); } }
private void GetSection() { // 查询科室信息 string sql_sectionInfo = "select a.sid,a.section_name from t_sectioninfo a inner join t_section_area b on a.sid=b.sid"; try { DataSet ds = App.GetDataSet(sql_sectionInfo); if (ds != null) { DataTable dt = ds.Tables[0]; for (int i = 0; i < dt.Rows.Count; i++) { Class_Sections section = new Class_Sections(); section.Sid = Convert.ToInt32(dt.Rows[i]["sid"]); section.Section_Name = dt.Rows[i]["section_name"].ToString(); ListViewItem listItem = new ListViewItem(); listItem.Tag = section; listItem.Text = section.Section_Name; lveSection1.Items.Add(listItem); } } } catch (Exception ex) { } }
private void btnClear_Click(object sender, EventArgs e) { if (currentSelectbig != null) { if (lvRelation.SelectedItems != null) { if (App.Ask("确定要删除所有关系?")) { if (SectionRelations != null) { for (int i = 0; i < SectionRelations.Length; i++) { Class_Sections temp = (Class_Sections)lvRelation.Items[i].Tag; string sql = "update T_SECTIONINFO set BELONGTO_BIGSECTION_ID=null where SID='" + temp.Sid + "'"; App.ExecuteSQL(sql); } lvRelation.Items.Clear(); } else { App.Msg("请先保存再清空关系设置或点击鼠标右键删除!"); } //trvRelation.Nodes.Clear(); } } } }
private void lvSection_RightToLeftLayoutChanged(object sender, EventArgs e) { if (lvSection.SelectedItems != null) { currentSection = (Class_Sections)lvSection.SelectedItems[0].Tag; } }
/// <summary> /// 授权 /// 1:删除以前的授权科室 /// 2:重新插入新的授权科室 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnRight_Click(object sender, EventArgs e) { if (trvAccount.SelectedNode != null) { if (lveSection2.Items.Count > 0) { string strsInsert = "delete from T_USER_SECTION_RIGHT where user_id=" + user.User_id; for (int i = 0; i < lveSection2.Items.Count; i++) { Class_Sections section = lveSection2.Items[i].Tag as Class_Sections; string sql_insert = "insert into T_USER_SECTION_RIGHT(user_id,section_id) values(" + Convert.ToInt32(user.User_id) + "," + section.Sid + ")"; strsInsert += "&" + sql_insert; } //转换成string类型的数组,批处理Sql string[] strArray = strsInsert.Split('&'); int num = App.ExecuteBatch(strArray); if (num > 0) { App.Msg("授权成功!"); } } else { App.Msg("请选择至少一个科室!"); } } else { App.Msg("请选择一个用户作为授权对象!"); } }
//private void lvRelation_MouseDown(object sender, MouseEventArgs e) //{ // lvRelation.SelectedItems = lvRelation.GetNodeAt(e.X, e.Y); //} private void lvBigsection_Click(object sender, EventArgs e) { if (lvBigsection.SelectedItems != null) { lvRelation.Items.Clear(); SectionRelations = null; currentSelectbig = (Class_Sections)lvBigsection.SelectedItems[0].Tag; lblSelectValue.Text = currentSelectbig.Section_Name; DataSet ds = App.GetDataSet("select * from T_SECTIONINFO where BELONGTO_BIGSECTION_ID='" + currentSelectbig.Sid + "'"); Class_Sections[] Directionarys = GetSelectDirectionary(ds); if (Directionarys != null) { SectionRelations = new Class_Sections[Directionarys.Length]; for (int i = 0; i < Directionarys.Length; i++) { SectionRelations[i] = Directionarys[i]; } for (int i = 0; i < Directionarys.Length; i++) { ListViewItem lvitem = new ListViewItem(); lvitem.Tag = Directionarys[i]; lvitem.Text = Directionarys[i].Section_Name; lvitem.ImageIndex = 1; lvRelation.Items.Add(lvitem); } } } btnSelect_B_Click(sender, e); }
private void lvSection_Click(object sender, EventArgs e) { if (lvSection.SelectedItems != null) { lvRelation.Items.Clear(); currentSection = (Class_Sections)lvSection.SelectedItems[0].Tag; lblSelectValue.Text = currentSection.Section_Name; DataSet ds = App.GetDataSet(@"select a.* from t_sickareainfo a inner join T_SECTION_AREA b on a.said = b.said where b.SID=" + currentSection.Sid.ToString() + ""); Class_Sickarea[] Directionarys = GetDirectionary(ds); if (Directionarys != null) { for (int i = 0; i < Directionarys.Length; i++) { ListViewItem lvitem = new ListViewItem(); lvitem.Tag = Directionarys[i]; lvitem.Text = Directionarys[i].Sick_area_name; lvitem.ImageIndex = 1; lvRelation.Items.Add(lvitem); } } } }
private void trvAccount_SelectedIndexChanged(object sender, EventArgs e) { try { if (trvAccount.SelectedNode != null) { GetUserInfo(user); lblName.Text = user.User_name; lblSex.Text = user.U_gender_code.Contains("1") ? "女" : "男"; lblId.Text = App.ReadSqlVal("select c.account_name from t_userinfo a inner join t_account_user b on a.user_id=b.user_id inner join t_account c on b.account_id=c.account_id where a.user_id=" + user.User_id, 0, "account_name"); lblPosition.Text = user.U_position_name; lblSection.Text = user.Section.Section_Name; lblSick_area.Text = user.Sickarea_id; lblTech_Post.Text = user.U_tech_post_name; lblInTime.Text = user.In_time.ToString(); //清空科室ListView的选中项 for (int i = 0; i < lveSection1.Items.Count; i++) { lveSection1.Items[i].Checked = false; } lveSection2.Items.Clear(); //设置已分配的科室为选中 string sql_sections = "select section_id from t_user_section_right where user_id=" + user.User_id; DataSet ds = App.GetDataSet(sql_sections); if (ds != null) { DataTable dt = ds.Tables[0]; for (int i = 0; i < dt.Rows.Count; i++) { foreach (ListViewItem lstItem in lveSection1.Items) { Class_Sections section = lstItem.Tag as Class_Sections; if (section.Sid == Convert.ToInt32(dt.Rows[i]["section_id"])) { lstItem.Checked = true; break; } } } btnAdd_Click(sender, e); } } } catch (Exception ex) { } }
private void 除ToolStripMenuItem_Click(object sender, EventArgs e) { if (currentSick != null) { if (lvRelation.SelectedItems != null) { if (App.Ask("你是否要删除?")) { Class_Sections temp = (Class_Sections)lvRelation.SelectedItems[0].Tag; App.ExecuteSQL("delete from T_SECTION_AREA where SID='" + temp.Sid.ToString() + "' and SAID='" + currentSick.Said + "'"); lvRelation.Items.Remove(lvRelation.SelectedItems[0]); } } } }
/// <summary> /// 绑定大科 /// </summary> private void BigSenction() { cboBigscience.Items.Clear(); Class_Sections none = new Class_Sections(); none.Sid = 0; none.Section_Code = "无"; none.Section_Name = "无"; none.Belongto_Section_Id = "无"; none.isCheckSection = "无"; none.Belongto_Section_Name = "无"; none.Belongto_BigSection_ID = "无"; none.isBelongToBigSection = "无"; none.Type = "无"; none.Inout_flag = "无"; none.Manage_type = "无"; none.State = "无"; none.Belongto_hospital = "无"; cboBigscience.Items.Add(none); string sql = "select * from T_SECTIONINFO where ISBELONGTOBIGSECTION='Y' and ENABLE_FLAG='Y'"; DataSet ds = App.GetDataSet(sql); section = new Class_Sections[ds.Tables[0].Rows.Count]; for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { section[i] = new Class_Sections(); section[i].Sid = Convert.ToInt32(ds.Tables[0].Rows[i]["SID"].ToString()); section[i].Section_Code = ds.Tables[0].Rows[i]["SECTION_CODE"].ToString(); section[i].Section_Name = ds.Tables[0].Rows[i]["SECTION_NAME"].ToString(); section[i].Belongto_Section_Id = ds.Tables[0].Rows[i]["BELONGTO_SECTION_ID"].ToString(); section[i].isCheckSection = ds.Tables[0].Rows[i]["ISCHECKSECTION"].ToString(); section[i].Belongto_Section_Name = ds.Tables[0].Rows[i]["BELONGTO_SECTION_NAME"].ToString(); section[i].Belongto_BigSection_ID = ds.Tables[0].Rows[i]["BELONGTO_BIGSECTION_ID"].ToString(); section[i].isBelongToBigSection = ds.Tables[0].Rows[i]["ISBELONGTOBIGSECTION"].ToString(); section[i].Type = ds.Tables[0].Rows[i]["TYPEINFO"].ToString(); section[i].Inout_flag = ds.Tables[0].Rows[i]["IN_FLAG"].ToString(); section[i].Manage_type = ds.Tables[0].Rows[i]["MANAGE_TYPE"].ToString(); section[i].State = ds.Tables[0].Rows[i]["ENABLE_FLAG"].ToString(); section[i].Belongto_hospital = ds.Tables[0].Rows[i]["SHID"].ToString(); cboBigscience.Items.Add(section[i]); } cboBigscience.ValueMember = "SID"; cboBigscience.DisplayMember = "SECTION_NAME"; //cboBigscience.SelectedValue = "SID"; }
/// <summary> /// 根据表格选中下拉列表 /// </summary> /// <returns></returns> public void SelectValues(string sid) { //bool flag = false; foreach (object var in cboBigscience.Items) { Class_Sections class_Section = var as Class_Sections; if (sid == class_Section.Sid.ToString()) { cboBigscience.SelectedItem = var; break; } else { cboBigscience.SelectedIndex = 0; } } }
/// <summary> /// 科室列表加载 /// </summary> private void SectionLoad() { string sql_Section = "select sid,section_name from t_sectioninfo where enable_flag='Y' and is_follow_visit='Y'"; DataSet ds_section = App.GetDataSet(sql_Section); if (ds_section != null) { DataTable dt = ds_section.Tables[0]; foreach (DataRow row in dt.Rows) { Class_Sections section = new Class_Sections(); section.Sid = Convert.ToInt32(row["sid"]); section.Section_Name = row["section_name"].ToString(); clbSection.Items.Add(section.Sid + ":" + section.Section_Name); } } }
/// <summary> /// 判断关系是否重复设置 /// </summary> /// <param Name="Id"></param> /// <returns></returns> private bool isExist(int id) { bool flag = false; for (int i = 0; i < lvRelation.Items.Count; i++) { if (lvRelation.Items[i].Tag.GetType().ToString().Contains("Class_Sections")) { Class_Sections temp = (Class_Sections)lvRelation.Items[i].Tag; if (temp.Sid == id) { flag = true; } } } return(flag); }
/// <summary> /// 查询科室 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSelect_Click(object sender, EventArgs e) { try { trvSectionItems.Nodes.Clear(); string SectionName = txtName.Text; string sql = ""; if (SectionName != "") { sql = "select * from T_SECTIONINFO where SECTION_NAME like '%" + SectionName + "%' and ISBELONGTOBIGSECTION='Y' and ENABLE_FLAG='Y'"; } else { sql = "select * from T_SECTIONINFO where ISBELONGTOBIGSECTION='Y'and ENABLE_FLAG='Y'"; } DataSet ds = App.GetDataSet(sql); if (ds != null) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { TreeNode tn = new TreeNode(); Class_Sections section = new Class_Sections(); section.Sid = Convert.ToInt32(ds.Tables[0].Rows[i]["SID"]); section.Section_Code = ds.Tables[0].Rows[i]["SECTION_CODE"].ToString(); section.Section_Name = ds.Tables[0].Rows[i]["SECTION_NAME"].ToString(); section.Belongto_Section_Id = ds.Tables[0].Rows[i]["BELONGTO_SECTION_ID"].ToString(); section.isCheckSection = ds.Tables[0].Rows[i]["ISCHECKSECTION"].ToString(); section.Belongto_Section_Name = ds.Tables[0].Rows[i]["BELONGTO_SECTION_NAME"].ToString(); section.Belongto_BigSection_ID = ds.Tables[0].Rows[i]["BELONGTO_BIGSECTION_ID"].ToString(); section.isBelongToBigSection = ds.Tables[0].Rows[i]["ISBELONGTOBIGSECTION"].ToString(); section.Type = ds.Tables[0].Rows[i]["TYPEINFO"].ToString(); section.Inout_flag = ds.Tables[0].Rows[i]["IN_FLAG"].ToString(); section.Manage_type = ds.Tables[0].Rows[i]["MANAGE_TYPE"].ToString(); section.State = ds.Tables[0].Rows[i]["ENABLE_FLAG"].ToString(); section.Belongto_hospital = ds.Tables[0].Rows[i]["SHID"].ToString(); tn.Name = section.Sid.ToString(); tn.Text = section.Section_Name; tn.Tag = section; trvSectionItems.Nodes.Add(tn); } } } catch (Exception ex) { } }
/// <summary> /// 设置关系 /// </summary> /// <param Name="sender"></param> /// <param Name="e"></param> private void lvSmallscience_MouseDoubleClick(object sender, MouseEventArgs e) { if (lvSmallscience.SelectedItems != null) { if (lvSmallscience.SelectedItems[0].Tag.GetType().ToString().Contains("Class_Sections")) { Class_Sections temp = (Class_Sections)lvSmallscience.SelectedItems[0].Tag; if (!isExist(Convert.ToInt32(temp.Sid))) { ListViewItem lvitem = new ListViewItem(); lvitem.Tag = temp; lvitem.Text = temp.Section_Name; lvitem.ImageIndex = 1; lvRelation.Items.Add(lvitem); lvSmallscience.Items.Remove(lvSmallscience.SelectedItems[0]); } } } }
/// <summary> /// 保存关系设置 /// </summary> /// <param Name="sender"></param> /// <param Name="e"></param> private void btnSave_Click(object sender, EventArgs e) { try { if (currentSelectbig != null) { //清空原有关系 if (SectionRelations != null) { for (int i = 0; i < SectionRelations.Length; i++) { App.ExecuteSQL("update T_SECTIONINFO set BELONGTO_BIGSECTION_ID=null where SID='" + SectionRelations[i].Sid + "'"); } } //设置现有关系 for (int i = 0; i < lvRelation.Items.Count; i++) { if (lvRelation.Items[i].Tag.GetType().ToString().Contains("Class_Sections")) { Class_Sections temp = (Class_Sections)lvRelation.Items[i].Tag; App.ExecuteSQL("update T_SECTIONINFO set BELONGTO_BIGSECTION_ID='" + currentSelectbig.Sid + "' where SID='" + temp.Sid + "'"); } } App.Msg("操作成功!"); btnSelect_B_Click(sender, e); } else { App.Msg("请先选择大科表!"); } } catch (Exception ex) { App.Msg("操作失败,原因:" + ex.ToString() + ""); } }
/// <summary> /// 解除大科与小科的关系设置 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void 除ToolStripMenuItem_Click(object sender, EventArgs e) { if (currentSelectbig != null) { if (lvRelation.SelectedItems != null) { if (App.Ask("你是否要删除?")) { Class_Sections temp = (Class_Sections)lvRelation.SelectedItems[0].Tag; //TreeNode tn = new TreeNode(); //tn.Tag = temp; //tn.Text = temp.Section_Name; ListViewItem lvitem = new ListViewItem(); lvitem.Tag = temp; lvitem.Text = temp.Section_Name; App.ExecuteSQL("update T_SECTIONINFO set BELONGTO_BIGSECTION_ID=null where where SID='" + temp.Sid + "'"); lvitem.ImageIndex = 1; lvSmallscience.Items.Add(lvitem); lvRelation.Items.Remove(lvRelation.SelectedItems[0]); } } } }
/// <summary> /// 实例化查询科室结果 /// </summary> /// <param Name="tempds"></param> /// <returns></returns> private Class_Sections[] GetSectionDirectionary(DataSet tempds) { if (tempds != null) { if (tempds.Tables[0].Rows.Count > 0) { Class_Sections[] Directionary = new Class_Sections[tempds.Tables[0].Rows.Count]; for (int i = 0; i < tempds.Tables[0].Rows.Count; i++) { Directionary[i] = new Class_Sections(); Directionary[i].Sid = Convert.ToInt32(tempds.Tables[0].Rows[i]["SID"].ToString()); Directionary[i].Section_Code = tempds.Tables[0].Rows[i]["SECTION_CODE"].ToString(); Directionary[i].Section_Name = tempds.Tables[0].Rows[i]["SECTION_NAME"].ToString(); Directionary[i].Belongto_Section_Id = tempds.Tables[0].Rows[i]["BELONGTO_SECTION_ID"].ToString(); Directionary[i].isCheckSection = tempds.Tables[0].Rows[i]["ISCHECKSECTION"].ToString(); Directionary[i].Belongto_Section_Name = tempds.Tables[0].Rows[i]["BELONGTO_SECTION_NAME"].ToString(); Directionary[i].Belongto_BigSection_ID = tempds.Tables[0].Rows[i]["BELONGTO_BIGSECTION_ID"].ToString(); Directionary[i].isBelongToBigSection = tempds.Tables[0].Rows[i]["ISBELONGTOBIGSECTION"].ToString(); Directionary[i].Type = tempds.Tables[0].Rows[i]["TYPEINFO"].ToString(); Directionary[i].Inout_flag = tempds.Tables[0].Rows[i]["IN_FLAG"].ToString(); Directionary[i].Manage_type = tempds.Tables[0].Rows[i]["MANAGE_TYPE"].ToString(); Directionary[i].State = tempds.Tables[0].Rows[i]["ENABLE_FLAG"].ToString(); Directionary[i].Belongto_hospital = tempds.Tables[0].Rows[i]["SHID"].ToString(); } return(Directionary); } else { return(null); } } else { return(null); } }
/// <summary> /// 保存 /// </summary> /// <param Name="sender"></param> /// <param Name="e"></param> private void btnSave_Click(object sender, EventArgs e) { try { if (txtID.Text.Trim() == "") { App.Msg("科室信息编号必须填写!"); txtID.Focus(); return; } if (txtName.Text.Trim() == "") { App.Msg("科室名称必须填写!"); txtName.Focus(); return; } //是否为检查科 if (!rbtnYes.Checked) { inspection = "N"; } //是否为大科 if (!rdtnScienceYes.Checked) { Science = "N"; } if (cboType.Text.Trim() == "") { App.Msg("类型必须填写!"); cboType.Focus(); return; } //住院及门诊科室标志 if (!rbtnHospital.Checked) { Hospital = "O"; } if (cboProperty.Text.Trim() == "") { App.Msg("科室管理属性必须填写!"); cboProperty.Focus(); return; } //有效标志 if (!rbtnValidmark.Checked) { Mark = "N"; } if (cboBranchcourts.Text.Trim() == "") { App.Msg("所属分院必须填写!"); cboBranchcourts.Focus(); return; } string sql = ""; string bigid = ""; if (rdtnScienceYes.Checked) { bigid = null; } else { if (cboBigscience.SelectedItem != null) { Class_Sections temp = (Class_Sections)cboBigscience.SelectedItem; bigid = temp.Sid.ToString(); } } ID = App.GenId("T_SECTIONINFO", "SID").ToString(); if (IsSave) { if (isExisitNames(App.ToDBC(txtID.Text.Trim()))) { App.Msg("已经存在了相同的科室编号了!"); txtID.Focus(); return; } else if (Isnames(App.ToDBC(txtName.Text.Trim()))) { App.Msg("已经存在了相同的科室名称了!"); txtName.Focus(); return; } sql = "insert into T_SECTIONINFO(SID,SECTION_CODE,SECTION_NAME,BELONGTO_SECTION_ID,ISCHECKSECTION,BELONGTO_SECTION_NAME,BELONGTO_BIGSECTION_ID,ISBELONGTOBIGSECTION,TYPEINFO,IN_FLAG,MANAGE_TYPE,ENABLE_FLAG,SHID) values('" + ID + "','" + txtID.Text + "','" + txtName.Text + "','" + cboOffice.Text + "','" + inspection + "','" + cboComputation.Text + "','" + bigid + "','" + Science + "','" + cboType.SelectedValue + "','" + Hospital + "','" + cboProperty.SelectedValue + "','" + Mark + "','" + cboBranchcourts.SelectedValue + "')"; btnAdd_Click(sender, e); } else { if (section_code.Trim() != "") { if (txtID.Text.Trim() != section_code.Trim()) { if (isExisitNames(App.ToDBC(txtID.Text.Trim()))) { App.Msg("已经存在了相同的科室编号了!"); txtID.Focus(); return; } } } else if (section_name.Trim() != "") { if (txtName.Text.Trim() != section_name.Trim()) { if (Isnames(App.ToDBC(txtName.Text.Trim()))) { App.Msg("已经存在了相同的科室名称了!"); txtName.Focus(); return; } } } sql = "update T_SECTIONINFO set SECTION_CODE='" + txtID.Text + "',SECTION_NAME='" + App.ToDBC(txtName.Text) + "',BELONGTO_SECTION_ID='" + cboOffice.Text + "',ISCHECKSECTION='" + inspection + "',BELONGTO_SECTION_NAME='" + cboComputation.Text + "',BELONGTO_BIGSECTION_ID='" + bigid + "',ISBELONGTOBIGSECTION='" + Science + "',TYPEINFO='" + cboType.SelectedValue + "',IN_FLAG='" + Hospital + "',MANAGE_TYPE='" + cboProperty.SelectedValue + "',ENABLE_FLAG='" + Mark + "',SHID='" + cboBranchcourts.SelectedValue + "' where SID='" + ucGridviewX1.fg["编号", ucGridviewX1.fg.CurrentRow.Index].Value.ToString() + "'"; } if (sql != "") { if (App.ExecuteSQL(sql) > 0) { App.Msg("操作成功!"); btnCancel_Click(sender, e); } } //显示列表数据 ShowValue(); //string Sql = T_section_Sql + " order by SID asc"; //ucC1FlexGrid1.DataBd(Sql, "SID", "SID,SECTION_CODE,SECTION_NAME,BELONGTO_SECTION_ID,ISCHECKSECTION,BELONGTO_SECTION_NAME,BELONGTO_BIGSECTION_ID,ISBELONGTOBIGSECTION,TYPEINFO,TYPEINFO_NAME,IN_FLAG,MANAGE_TYPE,MANAGE_TYPE_NAME,ENABLE_FLAG,SHID,SHID_NAME", "编号,科室编号,科室名称,所属核算科室,是否是检查科,核算科名称,所属大科,是否大科,类别编号,类别,住院及门诊标志,科室管理属性编号,科室管理属性,有效标志,分院编号,分院名称"); } catch (Exception ex) { App.Msg("添加失败,原因:" + ex.ToString() + ""); } }
private void frmSectionCheck_Load(object sender, EventArgs e) { //老代码注释掉 //DataSet dataSet = App.GetDataSet("select distinct(ts.sid),ts.section_name from t_Section_Area tsa inner join t_Sectioninfo ts on tsa.sid=ts.sid"); #region 消息提醒使用 DataSet dataSet = new DataSet(); if (strT_Msg_Setting == 3) { dataSet = App.GetDataSet("select t.said as SID,t.sick_area_name as SECTION_NAME from T_SICKAREAINFO t"); } else { if (strT_Msg_Setting == 2) { dataSet = App.GetDataSet("select distinct(ts.sid),ts.section_name from t_Sectioninfo ts"); } else { dataSet = App.GetDataSet("select distinct(ts.sid),ts.section_name from t_Section_Area tsa inner join t_Sectioninfo ts on tsa.sid=ts.sid"); } } #endregion Class_Sections[] class_Sections; int lenght = dataSet.Tables[0].Rows.Count; CheckBox[] ff = new CheckBox[lenght]; for (int i = 0; i < lenght; i++) { class_Sections = new Class_Sections[lenght]; class_Sections[i] = new Class_Sections(); class_Sections[i].Sid = Convert.ToInt32(dataSet.Tables[0].Rows[i]["SID"].ToString()); class_Sections[i].Section_Name = dataSet.Tables[0].Rows[i]["SECTION_NAME"].ToString(); chkSectionListBox.Items.Add(class_Sections[i]); chkSectionListBox.DisplayMember = "Section_Name"; chkSectionListBox.ValueMember = "SID"; } if (ucYWCParam.FlexSection != null) { // Con_CheckBoxListUtil.SetCheck(this.chkSectionListBox, frmYWCParam.FlexSection); //chkSectionListBox.Items.Clear(); string[] temp = ucYWCParam.FlexSection.Split(','); foreach (string str in temp) { for (int i = 0; i < chkSectionListBox.Items.Count; i++) { if (str == chkSectionListBox.GetItemText(chkSectionListBox.Items[i])) { chkSectionListBox.Items.RemoveAt(i); //除自身规则的科室以外,已被选择的科室则移除它 } } } //Con_CheckBoxListUtil.RemoveExitItems(chkSectionListBox); } if (ywcSectionName != null) { Con_CheckBoxListUtil.SetCheck(this.chkSectionListBox, ywcSectionName); //老代码注释掉 //this.groupBox1.Text = "文书类型为:[" + documentType + "]的科室列表"; #region 消息提醒使用 if (strT_Msg_Setting == 3) { this.groupBox1.Text = "病区列表"; } else if (strT_Msg_Setting == 1 || strT_Msg_Setting == 2) { this.groupBox1.Text = "科室列表"; } else { this.groupBox1.Text = "文书类型为:[" + documentType + "]的科室列表"; } #endregion } else { //老代码注释掉 //this.groupBox1.Text = "科室列表"; #region 消息提醒使用 if (strT_Msg_Setting == 3) { this.groupBox1.Text = "病区列表"; } else { this.groupBox1.Text = "科室列表"; } #endregion } #region 消息提醒使用 if (strT_Msg_Setting == 1 || strT_Msg_Setting == 2 || strT_Msg_Setting == 3)//消息提醒使用 { // DataSet ds; if (STRMSGSECTION_IDS == "")//如果等于空,不需要进行选中提示 { for (int i = 0; i < chkSectionListBox.Items.Count; i++) { chkSectionListBox.SetItemChecked(i, false); } ywcSectionID = ""; ywcSectionName = ""; } } #endregion }
private void btnSave_Click(object sender, EventArgs e) { #region /* * try * { * panel1.Controls.Clear(); * string sql = "select * from t_sectioninfo where ISBELONGTOBIGSECTION='N'"; * * DataSet ds = App.GetDataSet(sql); * y = 0; * for (int i = 0; i < ds.Tables[0].Rows.Count; i++) * { * Class_Sections Section = new Class_Sections(); * Section.Sid = Convert.ToInt32(ds.Tables[0].Rows[i]["SID"].ToString()); * Section.Section_Name = ds.Tables[0].Rows[i]["SECTION_NAME"].ToString(); * if (Section.Sid.ToString() != "") * { * Section_HeadEmpowerment SecHead = new Section_HeadEmpowerment(Section.Sid.ToString(), Section.Section_Name); * SecHead.Location = new System.Drawing.Point(20, y); * SecHead.Size = new System.Drawing.Size(498, 164); * panel1.Controls.Add(SecHead); * y = y + SecHead.Height; * } * } * } * catch * {} */ #endregion #region //string sql_Section = "select * from t_sectioninfo where ISBELONGTOBIGSECTION='N'"; /* sql1 = "select u.user_id,u.user_name,u.section_id,t.section_name from t_userinfo u " + * @" inner join t_sectioninfo t on t.sid=u.section_id * select * from t_userinfo us inner join t_approve_accredit t on t.userid=us.user_id and t.sid=us.section_id * select u.user_id,u.user_name,u.section_id,t.section_name,t.ISBELONGTOBIGSECTION from t_userinfo u " + * @" inner join t_sectioninfo t on t.sid=u.section_id * * select u.user_id,u.user_name,u.section_id,sec.section_name,r.role_id,r.role_name from t_userinfo u * inner join t_account_user a on a.user_id=u.user_id * inner join t_account tot on tot.account_id=a.account_id * inner join t_acc_role tac on tac.account_id=tot.account_id * inner join t_role r on r.role_id=tac.role_id * inner join t_sectioninfo sec on sec.sid=u.section_id * where r.role_type='D' * * //"select distinct(a.user_id),a.user_name from t_userinfo a" + * // " inner join t_account_user b on a.user_id=b.user_id" + * // " inner join t_account c on b.account_id = c.account_id" + * // " inner join t_acc_role d on d.account_id = c.account_id" + * // " inner join t_role e on e.role_id = d.role_id" + * // " where a.section_id='" + Inpatient.Section_Id + "' and e.role_type='D'; * * //select * from t_userinfo us inner join t_approve_accredit t on t.userid=us.user_id and t.sid=us.section_id * //Class_Table[] NTables = new Class_Table[3]; * */ #endregion #region //try //{ // panel1.Controls.Clear(); // ArrayList Sqls = new ArrayList(); // Class_Table[] NTables = new Class_Table[3]; // NTables[0] = new Class_Table(); // NTables[0].Tablename = "Sections"; // NTables[0].Sql = "select * from t_sectioninfo where ISBELONGTOBIGSECTION='N' order by SID asc"; // NTables[1] = new Class_Table(); // NTables[1].Tablename = "Sections_Peoples"; // NTables[1].Sql = "select distinct(u.user_id),u.user_name,f.section_id,sec.section_name,sec.ISBELONGTOBIGSECTION,r.role_id,r.role_name,r.role_type from t_userinfo u " + // @"inner join t_account_user a on a.user_id=u.user_id " + // @"inner join t_account tot on tot.account_id=a.account_id " + // @"inner join t_acc_role tac on tac.account_id=tot.account_id " + // @" inner join t_role r on r.role_id=tac.role_id " + // @" inner join t_acc_role_range f on tac.id = f.acc_role_id " + // @"inner join t_sectioninfo sec on sec.sid=f.section_id"; // NTables[2] = new Class_Table(); // NTables[2].Tablename = "Sections_Exist_peoples"; // NTables[2].Sql = "select * from T_APPROVE_ACCREDIT tap inner join t_userinfo us on tap.userid=us.user_id"; // DataSet ds = App.GetDataSet(NTables); // y = 0; // for (int i = 0; i < ds.Tables[0].Rows.Count; i++) // { // Class_Sections Section = new Class_Sections(); // Section.Sid = Convert.ToInt32(ds.Tables[0].Rows[i]["SID"].ToString()); // Section.Section_Name = ds.Tables[0].Rows[i]["SECTION_NAME"].ToString(); // if (Section.Sid.ToString() != "") // { // Section_HeadEmpowerment SecHead = new Section_HeadEmpowerment(Section.Sid.ToString(), Section.Section_Name, ds); // SecHead.Location = new System.Drawing.Point(20, y); // SecHead.Size = new System.Drawing.Size(498, 164); // panel1.Controls.Add(SecHead); // y = y + SecHead.Height; // } // } //} //catch //{ } #endregion try { panel3.Controls.Clear(); ArrayList Sqls = new ArrayList(); y = 0; Class_Table[] NTables = new Class_Table[2]; NTables[0] = new Class_Table(); NTables[0].Tablename = "Sections_Peoples"; NTables[0].Sql = "select distinct(u.user_id),u.user_name,f.section_id,sec.section_name,sec.ISBELONGTOBIGSECTION,r.role_id,r.role_name,r.role_type from t_userinfo u " + @"inner join t_account_user a on a.user_id=u.user_id " + @"inner join t_account tot on tot.account_id=a.account_id " + @"inner join t_acc_role tac on tac.account_id=tot.account_id " + @" inner join t_role r on r.role_id=tac.role_id " + @" inner join t_acc_role_range f on tac.id = f.acc_role_id " + @"inner join t_sectioninfo sec on sec.sid=f.section_id"; NTables[1] = new Class_Table(); NTables[1].Tablename = "Sections_Exist_peoples"; NTables[1].Sql = "select * from T_APPROVE_ACCREDIT tap inner join t_userinfo us on tap.userid=us.user_id"; DataSet ds = App.GetDataSet(NTables); //获取所有项目分类 for (int i = 0; i < trvSectionItems.Nodes.Count; i++) { //判断项目是否被选中,选中的话就生成控件 if (trvSectionItems.Nodes[i].Checked) { if (trvSectionItems.Nodes[i].Tag != null) { Class_Sections tempNode = (Class_Sections)trvSectionItems.Nodes[i].Tag; Section_HeadEmpowerment SecHead = new Section_HeadEmpowerment(tempNode.Sid.ToString(), tempNode.Section_Name, ds); SecHead.Location = new System.Drawing.Point(20, y); SecHead.Size = new System.Drawing.Size(498, 164); panel3.Controls.Add(SecHead); y = y + SecHead.Height; } } } } catch { } }