📄 ppinforecord.cs
字号:
this.App_cb.Location = new System.Drawing.Point(256, 224);
this.App_cb.Name = "App_cb";
this.App_cb.Size = new System.Drawing.Size(120, 20);
this.App_cb.TabIndex = 15;
//
// label9
//
this.label9.Location = new System.Drawing.Point(32, 264);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(56, 16);
this.label9.TabIndex = 16;
this.label9.Text = "撤消日期";
//
// Repealtime_dtp
//
this.Repealtime_dtp.Format = System.Windows.Forms.DateTimePickerFormat.Short;
this.Repealtime_dtp.Location = new System.Drawing.Point(88, 256);
this.Repealtime_dtp.Name = "Repealtime_dtp";
this.Repealtime_dtp.Size = new System.Drawing.Size(100, 21);
this.Repealtime_dtp.TabIndex = 17;
//
// label10
//
this.label10.Location = new System.Drawing.Point(200, 264);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(56, 16);
this.label10.TabIndex = 18;
this.label10.Text = "撤消原因";
//
// Repealreson_txt
//
this.Repealreson_txt.Location = new System.Drawing.Point(256, 256);
this.Repealreson_txt.Name = "Repealreson_txt";
this.Repealreson_txt.Size = new System.Drawing.Size(120, 21);
this.Repealreson_txt.TabIndex = 19;
this.Repealreson_txt.Text = "";
//
// label11
//
this.label11.Location = new System.Drawing.Point(40, 296);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(32, 16);
this.label11.TabIndex = 20;
this.label11.Text = "备注";
//
// Remarks_txt
//
this.Remarks_txt.Location = new System.Drawing.Point(88, 288);
this.Remarks_txt.Multiline = true;
this.Remarks_txt.Name = "Remarks_txt";
this.Remarks_txt.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.Remarks_txt.Size = new System.Drawing.Size(288, 56);
this.Remarks_txt.TabIndex = 21;
this.Remarks_txt.Text = "";
//
// button1
//
this.button1.Location = new System.Drawing.Point(88, 352);
this.button1.Name = "button1";
this.button1.TabIndex = 22;
this.button1.Text = "确定";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(296, 352);
this.button2.Name = "button2";
this.button2.TabIndex = 23;
this.button2.Text = "取消";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// PpInfoRecord
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(408, 389);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.Remarks_txt);
this.Controls.Add(this.label11);
this.Controls.Add(this.Repealreson_txt);
this.Controls.Add(this.label10);
this.Controls.Add(this.Repealtime_dtp);
this.Controls.Add(this.label9);
this.Controls.Add(this.App_cb);
this.Controls.Add(this.label8);
this.Controls.Add(this.Section_cb);
this.Controls.Add(this.label7);
this.Controls.Add(this.Context_txt);
this.Controls.Add(this.label6);
this.Controls.Add(this.Reson_txt);
this.Controls.Add(this.label5);
this.Controls.Add(this.Type_cb);
this.Controls.Add(this.label4);
this.Controls.Add(this.Time_dtp);
this.Controls.Add(this.label3);
this.Controls.Add(this.Name_txt);
this.Controls.Add(this.label2);
this.Controls.Add(this.No_cb);
this.Controls.Add(this.label1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "PpInfoRecord";
this.Closing += new System.ComponentModel.CancelEventHandler(this.PpInfoRecord_Closing);
this.Load += new System.EventHandler(this.PpInfoRecord_Load);
this.ResumeLayout(false);
}
#endregion
#region 确定 添加成功,修改成功
private void button1_Click(object sender, System.EventArgs e)
{
if(PpInfoForm.PpId == "insert")
{
string str = "insert into PpInfo (pId,pDate,pType,pReason,pContext,pAppS,pApp,pRepealDate,pRepealReason,pRemarks) values (" + int.Parse(this.No_cb.Text) + ",'";
str += this.Time_dtp.Value.ToShortDateString() + "','" + this.Type_cb.Text + "','" + this.Reson_txt.Text + "','" + this.Context_txt.Text + "','";
str += this.Section_cb.Text + "','" + this.App_cb.Text + "','" + this.Repealtime_dtp.Value.ToShortDateString() + "','" + this.Repealreson_txt.Text + "','";
str += this.Remarks_txt.Text + "')";
Base bb = new Base();
bb.ExeSQL(str);
MessageBox.Show("添加成功!");
}
if(PpInfoForm.PpId == "update")
{
string str = "update PpInfo set pDate='" + this.Time_dtp.Value.ToShortDateString() + "',pType='" + this.Type_cb.Text + "',pReason='";
str += this.Reson_txt.Text + "',pContext='" + this.Context_txt.Text + "',pAppS='" + this.Section_cb.Text + "',pRepealDate='" + this.Repealtime_dtp.Value.ToShortDateString();
str += "',pRepealReason='" + this.Repealreson_txt.Text + "',pRemarks='" + this.Remarks_txt.Text + "' where pppId=" + int.Parse(this.ID);
Base bb = new Base();
bb.ExeSQL(str);
MessageBox.Show("修改成功!");
}
}
#endregion
#region 窗体出现 判断是按了 添加 还是 修改 安钮
private void PpInfoRecord_Load(object sender, System.EventArgs e)
{
PpInfoForm.ppff.Enabled = false;
if(PpInfoForm.PpId == "insert")
{
this.DBSection_cb();
this.DBApp_cb();
this.DBNo_cb();
}
if(PpInfoForm.PpId == "update")
{
string [] ss = PpInfoForm.ppff.sb.ToString().Split('#');
this.ID = ss[0];
this.No_cb.Text = ss[1];
this.No_cb.Enabled = false;
this.No_cb.DropDownStyle = ComboBoxStyle.Simple;
this.Name_txt.Text = ss[2];
this.Time_dtp.Text = ss[3];
this.Type_cb.Text = ss[4];
this.Reson_txt.Text = ss[5];
this.Context_txt.Text = ss[6];
this.Section_cb.Text =ss[7];
this.App_cb.Text = ss[8];
this.Repealtime_dtp.Text = ss[9];
this.Repealreson_txt.Text = ss[10];
this.Remarks_txt.Text = ss[11];
this.DBSection_cb();
this.DBApp_cb();
}
}
#endregion
#region 员工编号 部门下拉列表,批准人下拉列表 的数据填充方法
private void DBSection_cb()
{
string str = "select * from SectionInfo";
DataTable dt = new DataTable();
Base bb = new Base();
dt = bb.ExeSQLdt(str);
for(int i = 0 ; i < dt.Rows.Count ; i ++)
{
this.Section_cb.Items.Add(dt.Rows[i]["sName"].ToString());
}
}
private void DBApp_cb()
{
string str = "select * from EmployInfo";
Base bb = new Base();
this.dt = bb.ExeSQLdt(str);
for(int i = 0 ; i < this.dt.Rows.Count ; i ++)
{
this.App_cb.Items.Add(this.dt.Rows[i]["eName"].ToString());
}
}
private void DBNo_cb()
{
for(int i = 0 ; i < this.dt.Rows.Count ; i ++)
{
this.No_cb.Items.Add(this.dt.Rows[i]["eId"].ToString());
}
}
#endregion
#region 关闭窗体
//取消
private void button2_Click(object sender, System.EventArgs e)
{
PpInfoForm.ppff.Enabled = true;
this.Close();
}
#endregion
#region 关闭窗体 时让PpInfoForm 窗体的Enable属性设置为true
private void PpInfoRecord_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
PpInfoForm.ppff.Enabled = true;
}
#endregion
#region 当 员工编号 下拉列表 的值变化,员工姓名的值的也相应的变化
private void No_cb_SelectedIndexChanged(object sender, System.EventArgs e)
{
for(int i = 0 ; i< this.dt.Rows.Count ; i ++)
{
if(this.No_cb.Text == this.dt.Rows[i]["eId"].ToString())
{
this.Name_txt.Text = this.dt.Rows[i]["eName"].ToString();
break;
}
}
}
#endregion
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -