📄 frmnote.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace GEROSYS
{
/// <summary>
/// frmNote 的摘要说明。
/// </summary>
public class frmNote : System.Windows.Forms.Form
{
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.ComboBox cmbSend;
private System.Windows.Forms.CheckedListBox lstReceive;
private System.Windows.Forms.RichTextBox txtNote;
private System.Windows.Forms.RadioButton radioStyle;
private System.Windows.Forms.RadioButton radioLines;
private System.Windows.Forms.Button cmdAccept;
private System.Windows.Forms.Button cmdCancel;
private System.Windows.Forms.ComboBox cmbReceive;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public frmNote()
{
//
// 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.cmbSend = new System.Windows.Forms.ComboBox();
this.label2 = new System.Windows.Forms.Label();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.radioLines = new System.Windows.Forms.RadioButton();
this.radioStyle = new System.Windows.Forms.RadioButton();
this.lstReceive = new System.Windows.Forms.CheckedListBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.cmbReceive = new System.Windows.Forms.ComboBox();
this.txtNote = new System.Windows.Forms.RichTextBox();
this.cmdAccept = new System.Windows.Forms.Button();
this.cmdCancel = new System.Windows.Forms.Button();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.SuspendLayout();
//
// label1
//
this.label1.Location = new System.Drawing.Point(48, 40);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(88, 24);
this.label1.TabIndex = 0;
this.label1.Text = "发消息人:";
//
// cmbSend
//
this.cmbSend.Location = new System.Drawing.Point(144, 40);
this.cmbSend.Name = "cmbSend";
this.cmbSend.Size = new System.Drawing.Size(104, 20);
this.cmbSend.TabIndex = 1;
this.cmbSend.Text = "调度室";
//
// label2
//
this.label2.Location = new System.Drawing.Point(48, 72);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(72, 16);
this.label2.TabIndex = 2;
this.label2.Text = "收消息人:";
//
// groupBox1
//
this.groupBox1.Controls.Add(this.radioLines);
this.groupBox1.Controls.Add(this.radioStyle);
this.groupBox1.Location = new System.Drawing.Point(312, 16);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(248, 48);
this.groupBox1.TabIndex = 3;
this.groupBox1.TabStop = false;
//
// radioLines
//
this.radioLines.Location = new System.Drawing.Point(128, 16);
this.radioLines.Name = "radioLines";
this.radioLines.Size = new System.Drawing.Size(64, 24);
this.radioLines.TabIndex = 1;
this.radioLines.Text = "群发";
this.radioLines.Click += new System.EventHandler(this.radioLines_Click);
//
// radioStyle
//
this.radioStyle.Location = new System.Drawing.Point(32, 24);
this.radioStyle.Name = "radioStyle";
this.radioStyle.Size = new System.Drawing.Size(56, 16);
this.radioStyle.TabIndex = 0;
this.radioStyle.Text = "单发";
//
// lstReceive
//
this.lstReceive.Location = new System.Drawing.Point(48, 104);
this.lstReceive.Name = "lstReceive";
this.lstReceive.Size = new System.Drawing.Size(200, 244);
this.lstReceive.TabIndex = 4;
//
// groupBox2
//
this.groupBox2.Controls.Add(this.cmbReceive);
this.groupBox2.Location = new System.Drawing.Point(24, 16);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(264, 344);
this.groupBox2.TabIndex = 5;
this.groupBox2.TabStop = false;
//
// cmbReceive
//
this.cmbReceive.Location = new System.Drawing.Point(120, 57);
this.cmbReceive.Name = "cmbReceive";
this.cmbReceive.Size = new System.Drawing.Size(104, 20);
this.cmbReceive.TabIndex = 0;
this.cmbReceive.Text = "comboBox1";
//
// txtNote
//
this.txtNote.Location = new System.Drawing.Point(312, 80);
this.txtNote.Name = "txtNote";
this.txtNote.Size = new System.Drawing.Size(248, 272);
this.txtNote.TabIndex = 6;
this.txtNote.Text = "";
//
// cmdAccept
//
this.cmdAccept.Location = new System.Drawing.Point(584, 24);
this.cmdAccept.Name = "cmdAccept";
this.cmdAccept.Size = new System.Drawing.Size(80, 32);
this.cmdAccept.TabIndex = 7;
this.cmdAccept.Text = "发送";
this.cmdAccept.Click += new System.EventHandler(this.cmdAccept_Click);
//
// cmdCancel
//
this.cmdCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cmdCancel.Location = new System.Drawing.Point(584, 72);
this.cmdCancel.Name = "cmdCancel";
this.cmdCancel.Size = new System.Drawing.Size(80, 32);
this.cmdCancel.TabIndex = 8;
this.cmdCancel.Text = "取消";
//
// frmNote
//
this.AcceptButton = this.cmdAccept;
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.CancelButton = this.cmdCancel;
this.ClientSize = new System.Drawing.Size(688, 370);
this.Controls.Add(this.cmdCancel);
this.Controls.Add(this.cmdAccept);
this.Controls.Add(this.txtNote);
this.Controls.Add(this.lstReceive);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.label2);
this.Controls.Add(this.cmbSend);
this.Controls.Add(this.label1);
this.Controls.Add(this.groupBox2);
this.Name = "frmNote";
this.Text = "短消息功能";
this.groupBox1.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private void getReceiveMessageMan()
{
AccessData AppClient=new AccessData ();
DataTable dtEmp =new DataTable();
int llCount;
int llMax;
string strSQL;
DataView dvEmp;
try
{
strSQL = "SELECT emp_name FROM emp ";
dtEmp=AppClient.SelectSQL(strSQL);
// dvEmp=new DataView (dtEmp);
// cmbReceive.DataSource =dvEmp;
// cmbReceive.DisplayMember="Emp_name";
for (llCount=0;llCount<dtEmp.Rows.Count;llCount++)
{
DataRow drEmp;
drEmp=dtEmp.Rows[llCount];
lstReceive.Items.Add(drEmp["emp_name"]);
cmbReceive.Items.Add(drEmp["emp_name"]);
}
}
catch(Exception ms)
{
MessageBox.Show(ms.Message, "General Error");
}
}
private void radioButton2_Click(object sender, System.EventArgs e)
{
// switch( )
// {
// case 0:
// bFlag = true;
// setButtonState (false);
// opInfo = OperateType.appAddInfo;
// AddClicked();
// break;
// case 2:
// setButtonState (false);
// opInfo = OperateType.appEditInfo ;
// break;}
}
private void radioLines_Click(object sender, System.EventArgs e)
{
radioStyle.Checked =false;
radioLines.Checked =true;
getReceiveMessageMan();
}
private void cmdAccept_Click(object sender, System.EventArgs e)
{
string strSQL;
AccessData AppClient=new AccessData ();
if (radioStyle.Checked)
{
strSQL="insert into shortmess (note_id,sendman,receiveman,style,note) values('000','" + this.cmbSend.Text.ToString()+ "','" + cmbReceive.Text.ToString() +"','0','" +txtNote.Text.ToString()+"')";
AppClient.ExecuteSQL(strSQL);
}
else
{
strSQL="insert into shortmess (note_id,sendman,receiveman,style,note) values('000','" + this.cmbSend.Text.ToString()+ "','" + cmbReceive.Text.ToString() +"','0','" +txtNote.Text.ToString()+"')";
AppClient.ExecuteSQL(strSQL);
this.lstReceive.SelectedValue =true;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -