📄 xinxidianweihuform.cs
字号:
//===========================================================================
// Smarclient FPMS Demo Project a sample project for SmartClient technology.
// Smarclient FPMS Demo is designed and implemented bases Microsoft Application Block tech.
// Author: SFPMS Team, Date 2004-11
// Vision 1.0
// Revison History
//=============================================================================
using System;
using System.Drawing;
using System.Data;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using JSW.Tool;
using JSW.FPMS.Tool;
using JSW.FPMS.Xian.KongZhi;
namespace JSW.FPMS.Xian.ShiTu
{
/// <summary>
/// XinXiDianWeiHuForm 的摘要说明。
/// </summary>
public class XinXiDianWeiHuForm : System.Windows.Forms.Form
{
#region 成员变量区域
private System.Windows.Forms.Label LB_BianHao;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox TB_BianHao;
private System.Windows.Forms.GroupBox GB_XinXiShuRu;
private System.Windows.Forms.Button BT_QueDing;
private System.Windows.Forms.Button BT_ShanChu;
private System.Windows.Forms.Button BT_QuXiao;
private System.ComponentModel.IContainer components= null;
private System.Windows.Forms.RichTextBox RB_XinJie;
private String bianHao = null;
private String bianhaoZFC = "XinXiDianBianHao";
private String mingxiZFC = "XinXiDianXiJie";
private String jibenShuJuJian = clsChangLiang.SHUJU_JIBENSHUJU_XINXIDIAN;
private String tianjiaMoShi = "信息点维护/添加信息点";
private String xiugaiMoShi = "信息点维护/修改信息点";
private clsXianKongZhi kongZhi = null;
#endregion
#region 私有方法区域
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.LB_BianHao = new System.Windows.Forms.Label();
this.TB_BianHao = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.GB_XinXiShuRu = new System.Windows.Forms.GroupBox();
this.RB_XinJie = new System.Windows.Forms.RichTextBox();
this.BT_ShanChu = new System.Windows.Forms.Button();
this.BT_QueDing = new System.Windows.Forms.Button();
this.BT_QuXiao = new System.Windows.Forms.Button();
this.GB_XinXiShuRu.SuspendLayout();
this.SuspendLayout();
//
// LB_BianHao
//
this.LB_BianHao.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.LB_BianHao.Location = new System.Drawing.Point(16, 24);
this.LB_BianHao.Name = "LB_BianHao";
this.LB_BianHao.Size = new System.Drawing.Size(120, 21);
this.LB_BianHao.TabIndex = 0;
this.LB_BianHao.Text = "信息点编号";
this.LB_BianHao.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// TB_BianHao
//
this.TB_BianHao.Location = new System.Drawing.Point(136, 24);
this.TB_BianHao.MaxLength = 20;
this.TB_BianHao.Name = "TB_BianHao";
this.TB_BianHao.Size = new System.Drawing.Size(256, 21);
this.TB_BianHao.TabIndex = 1;
this.TB_BianHao.Text = "";
//
// label2
//
this.label2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.label2.Location = new System.Drawing.Point(16, 56);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(120, 21);
this.label2.TabIndex = 2;
this.label2.Text = "信息点细节";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// GB_XinXiShuRu
//
this.GB_XinXiShuRu.Controls.Add(this.RB_XinJie);
this.GB_XinXiShuRu.Controls.Add(this.LB_BianHao);
this.GB_XinXiShuRu.Controls.Add(this.TB_BianHao);
this.GB_XinXiShuRu.Controls.Add(this.label2);
this.GB_XinXiShuRu.Location = new System.Drawing.Point(8, 8);
this.GB_XinXiShuRu.Name = "GB_XinXiShuRu";
this.GB_XinXiShuRu.Size = new System.Drawing.Size(408, 136);
this.GB_XinXiShuRu.TabIndex = 3;
this.GB_XinXiShuRu.TabStop = false;
//
// RB_XinJie
//
this.RB_XinJie.Location = new System.Drawing.Point(136, 56);
this.RB_XinJie.MaxLength = 50;
this.RB_XinJie.Name = "RB_XinJie";
this.RB_XinJie.Size = new System.Drawing.Size(256, 64);
this.RB_XinJie.TabIndex = 3;
this.RB_XinJie.Text = "";
//
// BT_ShanChu
//
this.BT_ShanChu.Location = new System.Drawing.Point(256, 152);
this.BT_ShanChu.Name = "BT_ShanChu";
this.BT_ShanChu.TabIndex = 4;
this.BT_ShanChu.Text = "删除";
this.BT_ShanChu.Click += new System.EventHandler(this.BT_ShanChu_Click);
//
// BT_QueDing
//
this.BT_QueDing.Location = new System.Drawing.Point(176, 152);
this.BT_QueDing.Name = "BT_QueDing";
this.BT_QueDing.Size = new System.Drawing.Size(72, 23);
this.BT_QueDing.TabIndex = 6;
this.BT_QueDing.Text = "确定";
this.BT_QueDing.Click += new System.EventHandler(this.BT_QueDing_Click);
//
// BT_QuXiao
//
this.BT_QuXiao.Location = new System.Drawing.Point(336, 152);
this.BT_QuXiao.Name = "BT_QuXiao";
this.BT_QuXiao.TabIndex = 7;
this.BT_QuXiao.Text = "取消";
this.BT_QuXiao.Click += new System.EventHandler(this.BT_QuXiao_Click);
//
// XinXiDianWeiHuForm
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(424, 189);
this.Controls.Add(this.BT_QuXiao);
this.Controls.Add(this.BT_QueDing);
this.Controls.Add(this.BT_ShanChu);
this.Controls.Add(this.GB_XinXiShuRu);
this.Location = new System.Drawing.Point(450, 400);
this.MaximumSize = new System.Drawing.Size(432, 216);
this.MinimumSize = new System.Drawing.Size(432, 216);
this.Name = "XinXiDianWeiHuForm";
this.GB_XinXiShuRu.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// 获得相应的数据
/// </summary>
/// <param name="ShuJuJian">数据种类键值</param>
/// <returns>数据</returns>
private String HuoDeShuJu(Hashtable ShuJu,string ShuJuJian)
{
//是否有该键值
if(!ShuJu.ContainsKey(ShuJuJian))
{
return null;
}
//获得相应的值
IDictionaryEnumerator jiHe = ShuJu.GetEnumerator();
while ( jiHe.MoveNext() )
{
if(jiHe.Key.Equals(ShuJuJian) )
{
break;
}
}
//返回数据
return (jiHe.Value as String);
}
/// <summary>
/// 数据合法性检测
/// </summary>
private bool ShuJuJianCe()
{
if(this.bianHao == null)
{
if(this.TB_BianHao.Text.Length <=0)
{
MessageBox.Show(this,"编号不能为空,请重新输入","数据合法性检测");
return false;
}
}
return true;
}
#region 事件响应区域
/// <summary>
/// 确定按钮单击响应事件
/// </summary>
private void BT_QueDing_Click(object sender, System.EventArgs e)
{
//数据检测
if(!ShuJuJianCe())
{
return ;
}
//数据维护操作
try
{
kongZhi.ShuJuWeiHu(jibenShuJuJian,clsChangLiang.SHUJU_XIUGAI,bianhaoZFC,GouZaoShuJu());
this.Dispose();
}
catch(Exception genException)
{
clsRiZhiChuLi.JiLuRiZhi(genException.Message);
if(DialogResult.No == MessageBox.Show(this,
"出现错误,你是否继续操作!参考日志,获得该错误的详细信息","提示信息",MessageBoxButtons.YesNo))
{
this.Dispose();
}
}
}
/// <summary>
/// 删除按钮单击响应事件
/// </summary>
private void BT_ShanChu_Click(object sender, System.EventArgs e)
{
//提示
if(this.bianHao != null && DialogResult.Yes != MessageBox.Show(this,
"确认删除本条数据?","提示信息",MessageBoxButtons.YesNo))
{
return;
}
//数据检测
if(!ShuJuJianCe())
{
return ;
}
//数据维护操作
try
{
if(this.bianHao == null) //添加数据模式
{
kongZhi.ShuJuWeiHu(jibenShuJuJian,clsChangLiang.SHUJU_TIANJIA,bianhaoZFC,GouZaoShuJu());
}
else //删除数据模式
{
kongZhi.ShuJuWeiHu(jibenShuJuJian,clsChangLiang.SHUJU_SHANCHU,bianhaoZFC,GouZaoShuJu());
}
this.Dispose();
}
catch(Exception genException)
{
clsRiZhiChuLi.JiLuRiZhi(genException.Message);
if(DialogResult.Yes != MessageBox.Show(this,
"出现错误,你是否继续操作!参考日志,获得该错误的详细信息","提示信息",MessageBoxButtons.YesNo))
{
this.Dispose();
}
}
}
/// <summary>
/// 取消按钮单击响应事件
/// </summary>
private void BT_QuXiao_Click(object sender, System.EventArgs e)
{
this.Dispose();
}
/// <summary>
/// 构造数据HashTable
/// </summary>
/// <returns></returns>
private Hashtable GouZaoShuJu()
{
Hashtable HT = new Hashtable();
HT.Add(this.bianhaoZFC,this.TB_BianHao.Text);
HT.Add(this.mingxiZFC,this.RB_XinJie.Text);
return HT;
}
#endregion
#endregion
#region 保护方法区域
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#endregion
#region 公有方法区域
/// <summary>
/// 维护已经有的数据
/// </summary>
/// <param name="KongZhi"></param>
/// <param name="BianHao"></param>
/// <param name="MingXi"></param>
public XinXiDianWeiHuForm(clsXianKongZhi KongZhi,Hashtable ShuJu)
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
kongZhi = KongZhi;
//更新数据模式
bianHao = this.HuoDeShuJu(ShuJu,bianhaoZFC) ;
string mingXi = this.HuoDeShuJu(ShuJu,mingxiZFC);
this.TB_BianHao.Text=bianHao;
this.RB_XinJie.Text=mingXi;
this.Text = xiugaiMoShi;
this.TB_BianHao.Enabled=false;
}
/// <summary>
/// 构造器,新的数据
/// </summary>
/// <param name="KongZhi"></param>
public XinXiDianWeiHuForm(clsXianKongZhi KongZhi)
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
kongZhi = KongZhi;
//添加数据模式
this.Text = tianjiaMoShi;
this.BT_QueDing.Visible=false;
this.BT_ShanChu.Text = "确定";
}
#endregion
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -