📄 contacts.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using GzglClient.BLL;
namespace GzglClient.Froms
{
/// <summary>
/// Contacts 的摘要说明。
/// </summary>
public class Contacts : System.Windows.Forms.Form
{
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button btnOK;
private System.Windows.Forms.TextBox txtName;
private System.Windows.Forms.TextBox txtPhone;
private System.Windows.Forms.Label label3;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public Contacts()
{
//
// 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.label1 = new System.Windows.Forms.Label();
this.txtName = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.txtPhone = new System.Windows.Forms.TextBox();
this.btnOK = new System.Windows.Forms.Button();
this.label3 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// label1
//
this.label1.Location = new System.Drawing.Point(56, 80);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(72, 23);
this.label1.TabIndex = 0;
this.label1.Text = "联系人:";
//
// txtName
//
this.txtName.Location = new System.Drawing.Point(128, 80);
this.txtName.Name = "txtName";
this.txtName.Size = new System.Drawing.Size(176, 21);
this.txtName.TabIndex = 1;
this.txtName.Text = "";
//
// label2
//
this.label2.Location = new System.Drawing.Point(56, 112);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(72, 23);
this.label2.TabIndex = 0;
this.label2.Text = "联系电话:";
//
// txtPhone
//
this.txtPhone.Location = new System.Drawing.Point(128, 112);
this.txtPhone.Name = "txtPhone";
this.txtPhone.Size = new System.Drawing.Size(176, 21);
this.txtPhone.TabIndex = 1;
this.txtPhone.Text = "";
//
// btnOK
//
this.btnOK.Location = new System.Drawing.Point(240, 144);
this.btnOK.Name = "btnOK";
this.btnOK.TabIndex = 2;
this.btnOK.Text = "提交";
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
//
// label3
//
this.label3.Location = new System.Drawing.Point(56, 24);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(256, 32);
this.label3.TabIndex = 3;
this.label3.Text = "为了加快审批速度,请单位认真填写联系人和联系电话(此信息必须填写)";
//
// Contacts
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(376, 190);
this.Controls.Add(this.label3);
this.Controls.Add(this.btnOK);
this.Controls.Add(this.txtName);
this.Controls.Add(this.txtPhone);
this.Controls.Add(this.label1);
this.Controls.Add(this.label2);
this.Name = "Contacts";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "联系人与联系电话";
this.Load += new System.EventHandler(this.Contacts_Load);
this.ResumeLayout(false);
}
#endregion
private void btnOK_Click(object sender, System.EventArgs e)
{
if(txtName.Text == "" || txtPhone.Text == "")
{
MessageBox.Show("联系人和联系电话必须填写!");
}
else
{
JinrmGzglServ.GetGzglData jgs = new GzglClient.JinrmGzglServ.GetGzglData(AllStr.WebServiceUrl);
if(jgs.UpdateContacts(AllStr.Key,txtName.Text,txtPhone.Text))
{
MessageBox.Show("联系人和联系电话填写成功!");
this.DialogResult = DialogResult.OK;
}
else
{
MessageBox.Show("联系人和联系电话填写失败!");
}
}
}
private void Contacts_Load(object sender, System.EventArgs e)
{
JinrmGzglServ.GetGzglData jgs = new GzglClient.JinrmGzglServ.GetGzglData(AllStr.WebServiceUrl);
string Contacts = jgs.GetContacts(AllStr.Key);
if(Contacts != "")
{
string[] ContactsStr = Contacts.Split('|');
txtName.Text = ContactsStr[0].ToString();
txtPhone.Text = ContactsStr[1].ToString();
}
else
{
MessageBox.Show("联系人和联系电话填写失败!");
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -