📄 frmchooseorg.cs
字号:
using System;
using System.Data;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.IO;
using Jinrm.Data;
using Jinrm.FileSystem;
using GzglClient.BLL;
using GzglClient.Froms;
namespace GzglClient.Froms
{
/// <summary>
/// frmChoose 的摘要说明。
/// </summary>
public class frmChooseOrg : System.Windows.Forms.Form
{
private System.Windows.Forms.ColumnHeader columnHeader12;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox txtOrgName;
private System.Windows.Forms.ListView ItemList;
private System.Windows.Forms.ColumnHeader columnHeader1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.ComboBox cbArea;
private PinkieControls.ButtonXP btnSel;
private PinkieControls.ButtonXP btnChooseArea;
private System.Windows.Forms.Label LabSelMess;
private PinkieControls.ButtonXP btnCannel;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public frmChooseOrg()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.columnHeader12 = new System.Windows.Forms.ColumnHeader();
this.ItemList = new System.Windows.Forms.ListView();
this.columnHeader1 = new System.Windows.Forms.ColumnHeader();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.btnChooseArea = new PinkieControls.ButtonXP();
this.btnSel = new PinkieControls.ButtonXP();
this.cbArea = new System.Windows.Forms.ComboBox();
this.label2 = new System.Windows.Forms.Label();
this.txtOrgName = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.LabSelMess = new System.Windows.Forms.Label();
this.btnCannel = new PinkieControls.ButtonXP();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// columnHeader12
//
this.columnHeader12.Text = "单位名称";
this.columnHeader12.Width = 300;
//
// ItemList
//
this.ItemList.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnHeader12,
this.columnHeader1});
this.ItemList.FullRowSelect = true;
this.ItemList.GridLines = true;
this.ItemList.HideSelection = false;
this.ItemList.Location = new System.Drawing.Point(8, 112);
this.ItemList.Name = "ItemList";
this.ItemList.Size = new System.Drawing.Size(368, 320);
this.ItemList.TabIndex = 15;
this.ItemList.View = System.Windows.Forms.View.Details;
this.ItemList.DoubleClick += new System.EventHandler(this.ItemList_DoubleClick);
//
// columnHeader1
//
this.columnHeader1.Text = "单位Id";
this.columnHeader1.Width = 0;
//
// groupBox1
//
this.groupBox1.Controls.Add(this.btnCannel);
this.groupBox1.Controls.Add(this.btnChooseArea);
this.groupBox1.Controls.Add(this.btnSel);
this.groupBox1.Controls.Add(this.cbArea);
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.txtOrgName);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Location = new System.Drawing.Point(8, 8);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(368, 80);
this.groupBox1.TabIndex = 13;
this.groupBox1.TabStop = false;
//
// btnChooseArea
//
this.btnChooseArea.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(0)), ((System.Byte)(236)), ((System.Byte)(233)), ((System.Byte)(216)));
this.btnChooseArea.DefaultScheme = true;
this.btnChooseArea.DialogResult = System.Windows.Forms.DialogResult.None;
this.btnChooseArea.Hint = "";
this.btnChooseArea.Location = new System.Drawing.Point(280, 43);
this.btnChooseArea.Name = "btnChooseArea";
this.btnChooseArea.Scheme = PinkieControls.ButtonXP.Schemes.Blue;
this.btnChooseArea.Size = new System.Drawing.Size(64, 24);
this.btnChooseArea.TabIndex = 15;
this.btnChooseArea.Text = "选择区划";
this.btnChooseArea.Click += new System.EventHandler(this.btnChooseArea_Click);
//
// btnSel
//
this.btnSel.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(0)), ((System.Byte)(236)), ((System.Byte)(233)), ((System.Byte)(216)));
this.btnSel.DefaultScheme = true;
this.btnSel.DialogResult = System.Windows.Forms.DialogResult.None;
this.btnSel.Hint = "";
this.btnSel.Location = new System.Drawing.Point(280, 16);
this.btnSel.Name = "btnSel";
this.btnSel.Scheme = PinkieControls.ButtonXP.Schemes.Blue;
this.btnSel.Size = new System.Drawing.Size(40, 24);
this.btnSel.TabIndex = 14;
this.btnSel.Text = "查询";
this.btnSel.Click += new System.EventHandler(this.btnSel_Click);
//
// cbArea
//
this.cbArea.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbArea.Enabled = false;
this.cbArea.Items.AddRange(new object[] {
"连云港市",
"新浦区",
"海州区",
"连云区",
"开发区",
"东海县",
"赣榆县",
"灌云县",
"灌南县"});
this.cbArea.Location = new System.Drawing.Point(72, 46);
this.cbArea.Name = "cbArea";
this.cbArea.Size = new System.Drawing.Size(200, 20);
this.cbArea.TabIndex = 6;
//
// label2
//
this.label2.Location = new System.Drawing.Point(8, 49);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(56, 15);
this.label2.TabIndex = 5;
this.label2.Text = "区划:";
//
// txtOrgName
//
this.txtOrgName.Location = new System.Drawing.Point(72, 16);
this.txtOrgName.Name = "txtOrgName";
this.txtOrgName.Size = new System.Drawing.Size(200, 21);
this.txtOrgName.TabIndex = 1;
this.txtOrgName.Text = "";
//
// label1
//
this.label1.Location = new System.Drawing.Point(8, 24);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(56, 15);
this.label1.TabIndex = 0;
this.label1.Text = "单位名称:";
//
// label3
//
this.label3.Location = new System.Drawing.Point(8, 440);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(168, 15);
this.label3.TabIndex = 14;
this.label3.Text = "提示:查询后,双击列表框";
//
// LabSelMess
//
this.LabSelMess.Location = new System.Drawing.Point(16, 91);
this.LabSelMess.Name = "LabSelMess";
this.LabSelMess.Size = new System.Drawing.Size(352, 16);
this.LabSelMess.TabIndex = 16;
//
// btnCannel
//
this.btnCannel.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(0)), ((System.Byte)(236)), ((System.Byte)(233)), ((System.Byte)(216)));
this.btnCannel.DefaultScheme = true;
this.btnCannel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCannel.Hint = "";
this.btnCannel.Location = new System.Drawing.Point(320, 16);
this.btnCannel.Name = "btnCannel";
this.btnCannel.Scheme = PinkieControls.ButtonXP.Schemes.Blue;
this.btnCannel.Size = new System.Drawing.Size(40, 24);
this.btnCannel.TabIndex = 16;
this.btnCannel.Text = "关闭";
this.btnCannel.Visible = false;
this.btnCannel.Click += new System.EventHandler(this.btnCannel_Click);
//
// frmChooseOrg
//
this.AcceptButton = this.btnSel;
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.CancelButton = this.btnCannel;
this.ClientSize = new System.Drawing.Size(384, 461);
this.Controls.Add(this.LabSelMess);
this.Controls.Add(this.ItemList);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.label3);
this.Name = "frmChooseOrg";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "绑定单位-请选择单位";
this.Load += new System.EventHandler(this.frmChooseOrg_Load);
this.Closed += new System.EventHandler(this.frmChooseOrg_Closed);
this.groupBox1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private void btnSel_Click(object sender, System.EventArgs e)
{
#region 查询
this.Cursor = Cursors.WaitCursor;
if(txtOrgName.Text != "")
{
btnSel.Enabled = false;
ItemList.Items.Clear();
string _WebServiceUrl = AllStr.WebServiceUrl;
JinrmGzglServ.GetGzglData jgs;
try
{
jgs = new GzglClient.JinrmGzglServ.GetGzglData(_WebServiceUrl);
DataSet ds = jgs.GetRegOrgBaseDsFromDogNum(txtOrgName.Text,cbArea.Text);
for(int i=0;i<ds.Tables[0].Rows.Count;i++)
{
ListViewItem lv = ItemList.Items.Add(ds.Tables[0].Rows[i]["OrgName"].ToString());
lv.SubItems.Add(ds.Tables[0].Rows[i]["OrgBaseId"].ToString());
lv.SubItems.Add(ds.Tables[0].Rows[i]["OrgAreaId"].ToString());
}
LabSelMess.Text = "区划:" + cbArea.Text + " 条件:" + txtOrgName.Text + " 条数:" + ds.Tables[0].Rows.Count.ToString();
}
catch(Exception ex)
{
MessageBox.Show("获取数据出错!"+ ex.Message);
btnSel.Enabled = true;
}
btnSel.Enabled = true;
}
else
{
MessageBox.Show("请填写要查询的名称!");
}
this.Cursor = Cursors.Default;
#endregion
}
private void ItemList_DoubleClick(object sender, System.EventArgs e)
{
#region 绑定
if(ItemList.SelectedItems != null)
{
//UserOrgBaseId|UserOrgName|UserArea|UserPwd
JinrmGzglServ.GetGzglData jgs = new GzglClient.JinrmGzglServ.GetGzglData(AllStr.WebServiceUrl);
if(jgs.SetRegOrgBaseDsFromDogNum(AllStr.Key,ItemList.SelectedItems[0].SubItems[1].Text,GetAreaIdFromAreaName(cbArea.SelectedIndex)))
{
// DoAccess conn = new DoAccess("Data\\DataAcc.mdb");
// conn.ExecUpdate("UserInfo",
// "UserKey = '"+ AllStr.Key +
// "',UserPwd = 'lyg" +
// "',UserOrgName = '"+ ItemList.SelectedItems[0].SubItems[0].Text +
// "',UserOrgBaseId = '"+ ItemList.SelectedItems[0].SubItems[1].Text +
// "',UserArea = '"+ ItemList.SelectedItems[0].SubItems[2].Text +
// "'","UserId = '1'");
MessageBox.Show("初始密码为“lyg”!");
this.DialogResult = DialogResult.OK;
}
else
{
MessageBox.Show("绑定失败,请确定该单位是否绑定或带加密狗至工资处绑定!1");
}
}
else
{
MessageBox.Show("请选择要绑定的单位名称!");
}
#endregion
}
private void frmChooseOrg_Load(object sender, System.EventArgs e)
{
#region 区划
LoadAreaSetting();
#endregion
}
#region 加载区划配置文件
private void LoadAreaSetting()
{
string _WAreaId = AllStr.AreaId;
if(_WAreaId != "")
{
switch(_WAreaId)
{
case "320700":
cbArea.SelectedIndex = 0;
break ;
case "320705":
cbArea.SelectedIndex = 1;
break ;
case "320706":
cbArea.SelectedIndex = 2;
break ;
case "320703":
cbArea.SelectedIndex = 3;
break ;
case "320791":
cbArea.SelectedIndex = 4;
break ;
case "320722":
cbArea.SelectedIndex = 5;
break ;
case "320721":
cbArea.SelectedIndex = 6;
break ;
case "320723":
cbArea.SelectedIndex = 7;
break ;
case "320822":
cbArea.SelectedIndex = 8;
break ;
default:
cbArea.SelectedIndex = 0;
break ;
}
}
}
#endregion
#region 转换区划
private string GetAreaIdFromAreaName(int _SelecteIndex)
{
switch(_SelecteIndex)
{
case 0:
return "320700";
case 1:
return "320705";
case 2:
return "320706";
case 3:
return "320703";
case 4:
return "320791";
case 5:
return "320722";
case 6:
return "320721";
case 7:
return "320723";
case 8:
return "320822";
default:
return "320700";
}
}
#endregion
private void btnChooseArea_Click(object sender, System.EventArgs e)
{
frmAreaChoose fac = new frmAreaChoose();
if(fac.ShowDialog() == DialogResult.OK)
{
PublicFuc.LoadSetting();
LoadAreaSetting();
}
}
private void btnCannel_Click(object sender, System.EventArgs e)
{
//Application.Exit();
}
private void frmChooseOrg_Closed(object sender, System.EventArgs e)
{
//Application.Exit();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -