📄 personlist.cs
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;
using System.Threading;
using Jinrm.Data;
using GzglClient.ColumnStyles;
using GzglClient.Froms;
using GzglClient.BLL;
namespace GzglClient.Views
{
/// <summary>
/// PersonList 的摘要说明。
/// </summary>
public class PersonList : System.Windows.Forms.UserControl , IView
{
private System.Windows.Forms.ContextMenu PersonSort;
private System.Windows.Forms.MenuItem UpTop;
private System.Windows.Forms.MenuItem Up1;
private System.Windows.Forms.MenuItem Down1;
private System.Windows.Forms.MenuItem DownAll;
private System.Windows.Forms.MenuItem SortAll;
private System.Windows.Forms.MenuItem UpdateServ;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
private DoAccess conn = new DoAccess();
private string tempId;
internal System.Windows.Forms.DataGrid PersonListGrid;
private System.Windows.Forms.TreeView OrgTree;
private _800tom.common.PageSplit pageSplit1;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Splitter splitter1;
private System.Windows.Forms.Panel panel3;
private System.Windows.Forms.Splitter splitter2;
private System.Windows.Forms.Panel panel4;
private DataSet ds = null;
/// <summary>
/// 构造函数
/// </summary>
public PersonList()
{
// 该调用是 Windows.Forms 窗体设计器所必需的。
InitializeComponent();
// TODO: 在 InitializeComponent 调用后添加任何初始化
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region 组件设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器
/// 修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.PersonSort = new System.Windows.Forms.ContextMenu();
this.UpTop = new System.Windows.Forms.MenuItem();
this.Up1 = new System.Windows.Forms.MenuItem();
this.Down1 = new System.Windows.Forms.MenuItem();
this.DownAll = new System.Windows.Forms.MenuItem();
this.SortAll = new System.Windows.Forms.MenuItem();
this.UpdateServ = new System.Windows.Forms.MenuItem();
this.PersonListGrid = new System.Windows.Forms.DataGrid();
this.OrgTree = new System.Windows.Forms.TreeView();
this.pageSplit1 = new _800tom.common.PageSplit();
this.panel1 = new System.Windows.Forms.Panel();
this.panel2 = new System.Windows.Forms.Panel();
this.splitter1 = new System.Windows.Forms.Splitter();
this.panel3 = new System.Windows.Forms.Panel();
this.splitter2 = new System.Windows.Forms.Splitter();
this.panel4 = new System.Windows.Forms.Panel();
((System.ComponentModel.ISupportInitialize)(this.PersonListGrid)).BeginInit();
this.panel1.SuspendLayout();
this.panel2.SuspendLayout();
this.panel3.SuspendLayout();
this.panel4.SuspendLayout();
this.SuspendLayout();
//
// PersonSort
//
this.PersonSort.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.UpTop,
this.Up1,
this.Down1,
this.DownAll,
this.SortAll,
this.UpdateServ});
this.PersonSort.Popup += new System.EventHandler(this.PersonSort_Popup);
//
// UpTop
//
this.UpTop.Index = 0;
this.UpTop.Text = "上移到顶部";
this.UpTop.Click += new System.EventHandler(this.MainMenu_Click);
//
// Up1
//
this.Up1.Index = 1;
this.Up1.Text = "上移一个";
this.Up1.Click += new System.EventHandler(this.MainMenu_Click);
//
// Down1
//
this.Down1.Index = 2;
this.Down1.Text = "下移一个";
this.Down1.Click += new System.EventHandler(this.MainMenu_Click);
//
// DownAll
//
this.DownAll.Index = 3;
this.DownAll.Text = "下移到底部";
this.DownAll.Click += new System.EventHandler(this.MainMenu_Click);
//
// SortAll
//
this.SortAll.Index = 4;
this.SortAll.Text = "重新排序";
this.SortAll.Click += new System.EventHandler(this.MainMenu_Click);
//
// UpdateServ
//
this.UpdateServ.Index = 5;
this.UpdateServ.Text = "更新服务器";
this.UpdateServ.Click += new System.EventHandler(this.MainMenu_Click);
//
// PersonListGrid
//
this.PersonListGrid.AllowDrop = true;
this.PersonListGrid.BackgroundColor = System.Drawing.SystemColors.Window;
this.PersonListGrid.CaptionVisible = false;
this.PersonListGrid.ContextMenu = this.PersonSort;
this.PersonListGrid.DataMember = "";
this.PersonListGrid.Dock = System.Windows.Forms.DockStyle.Fill;
this.PersonListGrid.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.PersonListGrid.Location = new System.Drawing.Point(0, 0);
this.PersonListGrid.Name = "PersonListGrid";
this.PersonListGrid.ReadOnly = true;
this.PersonListGrid.Size = new System.Drawing.Size(640, 485);
this.PersonListGrid.TabIndex = 15;
//
// OrgTree
//
this.OrgTree.Dock = System.Windows.Forms.DockStyle.Fill;
this.OrgTree.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.OrgTree.ImageIndex = -1;
this.OrgTree.Location = new System.Drawing.Point(0, 0);
this.OrgTree.Name = "OrgTree";
this.OrgTree.SelectedImageIndex = -1;
this.OrgTree.Size = new System.Drawing.Size(200, 520);
this.OrgTree.TabIndex = 16;
this.OrgTree.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.OrgTree_AfterSelect);
//
// pageSplit1
//
this.pageSplit1.CurrentPage = 1;
this.pageSplit1.Cursor = System.Windows.Forms.Cursors.Hand;
this.pageSplit1.Location = new System.Drawing.Point(112, 8);
this.pageSplit1.Name = "pageSplit1";
this.pageSplit1.PageSize = 10;
this.pageSplit1.RecordCount = 0;
this.pageSplit1.Size = new System.Drawing.Size(432, 24);
this.pageSplit1.TabIndex = 14;
//
// panel1
//
this.panel1.Controls.Add(this.OrgTree);
this.panel1.Dock = System.Windows.Forms.DockStyle.Left;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(200, 520);
this.panel1.TabIndex = 17;
//
// panel2
//
this.panel2.Controls.Add(this.panel4);
this.panel2.Controls.Add(this.splitter2);
this.panel2.Controls.Add(this.panel3);
this.panel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel2.Location = new System.Drawing.Point(200, 0);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(640, 520);
this.panel2.TabIndex = 18;
//
// splitter1
//
this.splitter1.Location = new System.Drawing.Point(200, 0);
this.splitter1.Name = "splitter1";
this.splitter1.Size = new System.Drawing.Size(3, 520);
this.splitter1.TabIndex = 19;
this.splitter1.TabStop = false;
//
// panel3
//
this.panel3.Controls.Add(this.pageSplit1);
this.panel3.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panel3.Location = new System.Drawing.Point(0, 488);
this.panel3.Name = "panel3";
this.panel3.Size = new System.Drawing.Size(640, 32);
this.panel3.TabIndex = 16;
//
// splitter2
//
this.splitter2.Dock = System.Windows.Forms.DockStyle.Bottom;
this.splitter2.Location = new System.Drawing.Point(0, 485);
this.splitter2.Name = "splitter2";
this.splitter2.Size = new System.Drawing.Size(640, 3);
this.splitter2.TabIndex = 17;
this.splitter2.TabStop = false;
//
// panel4
//
this.panel4.Controls.Add(this.PersonListGrid);
this.panel4.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel4.Location = new System.Drawing.Point(0, 0);
this.panel4.Name = "panel4";
this.panel4.Size = new System.Drawing.Size(640, 485);
this.panel4.TabIndex = 18;
//
// PersonList
//
this.Controls.Add(this.splitter1);
this.Controls.Add(this.panel2);
this.Controls.Add(this.panel1);
this.Name = "PersonList";
this.Size = new System.Drawing.Size(840, 520);
this.Load += new System.EventHandler(this.PersonList_Load);
((System.ComponentModel.ISupportInitialize)(this.PersonListGrid)).EndInit();
this.panel1.ResumeLayout(false);
this.panel2.ResumeLayout(false);
this.panel3.ResumeLayout(false);
this.panel4.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private void PersonList_Load(object sender, System.EventArgs e)
{
BuildTopLevelTree();
PersonListGrid.TableStyles.Add(PersonListDgStyle.GetStyle());
}
private void PersonListGrid_DoubleClick(object sender, System.EventArgs e)
{
string tempIDCard = GetSelectedIDCard();
if(tempIDCard != "-1" && tempIDCard != "")
{
frmPersonEdit fpe = new frmPersonEdit(tempIDCard);
fpe.ShowDialog();
}
}
#region 树
private void BuildTopLevelTree()
{
DataSet ds = conn.GetDs("*","OrgBase","","");
if(ds.Tables[0].Rows.Count != 0)
{
string RootId = conn.GetValueFromName("ParentId","OrgBase","IsMainOrg = 'True' ");
if(RootId.Length == 10)
{
InitTree(OrgTree.Nodes,RootId,ds);
}
else
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -