private void attribute_Click(object sender, EventArgs e) { switch (tbinfo) { case "tuser": Frm_Euser euser = new Frm_Euser(listView1.SelectedItems[0].SubItems[2].Text, int.Parse(listView1.SelectedItems[0].SubItems[0].Text)); euser.ShowDialog(); this.ColumnsChang("tuser"); break; case "trole": Frm_Crole role = new Frm_Crole(listView1.SelectedItems[0].SubItems[1].Text, int.Parse(listView1.SelectedItems[0].SubItems[0].Text), this, 1); role.ShowDialog(); this.ColumnsChang("trole"); break; case "tmodule": //Frm_Emodule emodule = new Frm_Emodule(listView1.SelectedItems[0].SubItems[2].Text, int.Parse(listView1.SelectedItems[0].SubItems[0].Text)); // emodule.ShowDialog(); this.ColumnsChang("tmodule"); break; } }
private void create_Click(object sender, EventArgs e) { switch (tbinfo) { case "tuser": //同步用户 执行tbuser存储过程 SqlCommand sqlcmd = new SqlCommand(); sqlcmd.Connection = conn; try { conn.Open(); } catch { } sqlcmd.CommandType = CommandType.StoredProcedure; sqlcmd.CommandText = "tbuser"; sqlcmd.ExecuteNonQuery(); conn.Close(); this.ColumnsChang("tuser"); //Frm_Cuser cjuser = new Frm_Cuser(this); //cjuser.ShowDialog(); break; case "trole": Frm_Crole crole = new Frm_Crole(this, 0); crole.ShowDialog(); break; case "tmodule": //Frm_Cmodule module = new Frm_Cmodule(this); //module.ShowDialog(); //根据菜单项生成权限模块 string sql = "select AppSystem,ModuleName,ModulePage,ModuleMemo from tModule "; //.menuStrip1 SqlDataAdapter qx = new SqlDataAdapter(sql, conn); SqlCommandBuilder sb = new SqlCommandBuilder(qx); try { ds.Tables["tModule1"].Clear(); } catch { } qx.Fill(ds, "tModule1"); DataRow dr; for (int i = 0; i < fmain.menuStrip1.Items.Count; i++) { ToolStripMenuItem tm = (ToolStripMenuItem)fmain.menuStrip1.Items[i]; for (int j = 0; j < tm.DropDownItems.Count; j++) { DataRow[] drArr = ds.Tables["tModule1"].Select("ModulePage = '" + tm.DropDownItems[j].Name + "'"); if (drArr.Length == 0) { dr = ds.Tables["tModule1"].NewRow(); dr["AppSystem"] = "华健车间系统"; dr["ModuleName"] = fmain.menuStrip1.Items[i].Text; dr["ModulePage"] = tm.DropDownItems[j].Name; dr["ModuleMemo"] = tm.DropDownItems[j].Text; // dm1.tUser1.Rows.Add(dr); ds.Tables["tModule1"].Rows.Add(dr); } } } qx.Update(ds.Tables["tModule1"]); this.ColumnsChang("tmodule"); break; } }