📄 frmoperation.cs
字号:
this.printPreviewDialog1.Enabled = true;
this.printPreviewDialog1.Icon = ((System.Drawing.Icon)(resources.GetObject("printPreviewDialog1.Icon")));
this.printPreviewDialog1.Location = new System.Drawing.Point(167, 54);
this.printPreviewDialog1.MinimumSize = new System.Drawing.Size(375, 250);
this.printPreviewDialog1.Name = "printPreviewDialog1";
this.printPreviewDialog1.TransparencyKey = System.Drawing.Color.Empty;
this.printPreviewDialog1.Visible = false;
//
// frmoperation
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(632, 366);
this.Controls.Add(this.button1);
this.Controls.Add(this.label2);
this.Controls.Add(this.comboBox1);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.label1);
this.Controls.Add(this.button5);
this.Controls.Add(this.button4);
this.Controls.Add(this.button3);
this.Controls.Add(this.dataGrid1);
this.MaximizeBox = false;
this.MaximumSize = new System.Drawing.Size(640, 400);
this.MinimumSize = new System.Drawing.Size(640, 400);
this.Name = "frmoperation";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "操作历史记录";
this.Load += new System.EventHandler(this.frmoperation_Load);
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
this.ResumeLayout(false);
}
#endregion
private void frmoperation_Load(object sender, System.EventArgs e)
{
timer1.Start();
this.dataGrid1.SetDataBinding(objDataSet,"");
this.comboBox1.Items.Add("操作员管理");
this.comboBox1.Items.Add("住户费用缴交");
this.comboBox1.Items.Add("楼房居住记录");
this.comboBox1.Items.Add("员工在职记录");
this.comboBox1.Items.Add("员工工资发放记录");
}
private void timer1_Tick(object sender, System.EventArgs e)
{
this.textBox1.Text=System.DateTime .Now .ToString("yyyy-MM-dd")+" "+System.DateTime.Now.TimeOfDay.ToString().Substring(0,8);
}
private void button5_Click(object sender, System.EventArgs e)
{
this.Close();
}
private void button1_Click(object sender, System.EventArgs e)
{
string str=this.comboBox1.Text;
switch(str)
{
case("操作员管理"):
{
objSqlConn=new SqlConnection("database=atorregulate;user id=sa;password=;SERVER=(local)");
objSqlConn.Open();
objSqlDataAdapter=new SqlDataAdapter();
objSqlDataAdapter.SelectCommand=new SqlCommand("select Auid as 用户ID,Aname as 用户姓名,Aname as 权限等级,Apassword as 密码, AIDcard as 身份证,Aremark as 备注,Awritetime as 修改日期,Atype as 状态 from trigadmininsert",objSqlConn);
objDataSet=new DataSet();
objSqlDataAdapter.Fill(objDataSet,"trigadmininsert");
//将DATAGRID控件绑定到数据集表
this.dataGrid1.SetDataBinding(objDataSet,"trigadmininsert");
break;
}
case("住户费用缴交"):
{
objSqlConn=new SqlConnection("database=atorregulate;user id=sa;password=;SERVER=(local)");
objSqlConn.Open();
objSqlDataAdapter=new SqlDataAdapter();
objSqlDataAdapter.SelectCommand=new SqlCommand("select Musername as 住户姓名,Mhomenumber as 住户房号,Mwater as 水费,Melecticity as 电费,Mcar as 停车费,Mregulate as 物业管理费,Mrange as 排污费,Mgas as 煤气费,Mdata as 记录日期,Mtype as 状态 from trigfee",objSqlConn);
objDataSet=new DataSet();
objSqlDataAdapter.Fill(objDataSet,"trigfee");
//将DATAGRID控件绑定到数据集表
this.dataGrid1.SetDataBinding(objDataSet,"trigfee");
break;
}
case("楼房居住记录"):
{
objSqlConn=new SqlConnection("database=atorregulate;user id=sa;password=;SERVER=(local)");
objSqlConn.Open();
objSqlDataAdapter=new SqlDataAdapter();
objSqlDataAdapter.SelectCommand=new SqlCommand("select Nstorey as 房间编号,Nitem as 所属栋,Nusername as 业主姓名,Ntelnumber as 联系电话,Ndata as 记录日期,Ntype as 状态 from trigstorey",objSqlConn);
objDataSet=new DataSet();
objSqlDataAdapter.Fill(objDataSet,"trigstorey");
//将DATAGRID控件绑定到数据集表
this.dataGrid1.SetDataBinding(objDataSet,"trigstorey");
break;
}
case("员工在职记录"):
{
objSqlConn=new SqlConnection("database=atorregulate;user id=sa;password=;SERVER=(local)");
objSqlConn.Open();
objSqlDataAdapter=new SqlDataAdapter();
objSqlDataAdapter.SelectCommand=new SqlCommand("select Wnumber as 员工编号,Wname as 姓名,Wcarcor as 职位,WIDcard as 身份证,Waddress as 籍贯,Wtime as 记录日期,Wtype as 状态 from trigworker",objSqlConn);
objDataSet=new DataSet();
objSqlDataAdapter.Fill(objDataSet,"trigworker");
//将DATAGRID控件绑定到数据集表
this.dataGrid1.SetDataBinding(objDataSet,"trigworker");
break;
}
case("员工工资发放记录"):
{
objSqlConn=new SqlConnection("database=atorregulate;user id=sa;password=;SERVER=(local)");
objSqlConn.Open();
objSqlDataAdapter=new SqlDataAdapter();
objSqlDataAdapter.SelectCommand=new SqlCommand("select Enumber as 员工编号,Enumber as 基本工资,Eprizc as 奖金,Edata as 记录日期,Etype as 状态 from trigworkerearnings",objSqlConn);
objDataSet=new DataSet();
objSqlDataAdapter.Fill(objDataSet,"trigworkerearnings");
//将DATAGRID控件绑定到数据集表
this.dataGrid1.SetDataBinding(objDataSet,"trigworkerearnings");
break;
}
}
}
private void button4_Click(object sender, System.EventArgs e)
{
this.ppdlgOrderDatails .ShowDialog ();
}
private void button3_Click(object sender, System.EventArgs e)
{
if (this.printDialog2 .ShowDialog ()==DialogResult.OK )
{
this.pdocOrderDetails .Print ();
}
}
private void pdocOrderDetails_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
string str=this.comboBox1.Text;
switch(str)
{
case("操作员管理"):
{
objSqlConn=new SqlConnection("database=atorregulate;user id=sa;password=;SERVER=(local)");
objSqlConn.Open();
objSqlDataAdapter=new SqlDataAdapter();
objSqlDataAdapter.SelectCommand=new SqlCommand("select Auid as 用户ID,Aname as 用户姓名,Aname as 权限等级,Apassword as 密码, AIDcard as 身份证,Aremark as 备注,Awritetime as 修改日期,Atype as 状态 from trigadmininsert",objSqlConn);
objDataSet=new DataSet();
objSqlDataAdapter.Fill(objDataSet,"trigadmininsert");
//将DATAGRID控件绑定到数据集表
this.dataGrid1.SetDataBinding(objDataSet,"trigadmininsert");
Font objFont=new Font ("Tahoma",11,FontStyle.Regular );
Brush objBrush=Brushes.Black ;
Pen objPen=new Pen (objBrush);
objPen.Width =2;
int nLeft=this.pageSetupDialog1 .PageSettings .Margins .Left ;
int nTop=this.pageSetupDialog1 .PageSettings .Margins .Top ;
int nWidth=this.pageSetupDialog1 .PageSettings .PaperSize .Width -(this.pageSetupDialog1 .PageSettings .Margins .Left +this.pageSetupDialog1 .PageSettings .Margins .Right );
int nHeight=this.pageSetupDialog1 .PageSettings .PaperSize .Height -(this.pageSetupDialog1 .PageSettings .Margins .Bottom );
e.Graphics .DrawLine (objPen,nLeft,nTop,nLeft+nWidth,nTop);
e.Graphics .DrawLine (objPen,nLeft,nTop+nHeight,nLeft+nWidth,nTop+nHeight);
e.Graphics .DrawLine (objPen,nLeft,nTop,nLeft,nTop+nHeight);
e.Graphics .DrawLine (objPen,nLeft+nWidth,nTop,nLeft+nWidth,nTop+nHeight);
e.Graphics.DrawString ("操作员管理历史记录",new Font ("Garamond",36,FontStyle.Bold ),Brushes.Blue ,nLeft+30,nTop+10);
e.Graphics.DrawString ("ID",objFont,objBrush ,nLeft+10,nTop+60);
e.Graphics.DrawString ("姓名",objFont,objBrush ,nLeft+70,nTop+60);
e.Graphics.DrawString ("权限",objFont,objBrush ,nLeft+110,nTop+60);
e.Graphics.DrawString ("密码",objFont,objBrush ,nLeft+150,nTop+60);
e.Graphics.DrawString ("身份证",objFont,objBrush ,nLeft+190,nTop+60);
e.Graphics.DrawString ("备注",objFont,objBrush ,nLeft+360,nTop+60);
e.Graphics.DrawString ("记录时间",objFont,objBrush ,nLeft+400,nTop+60);
e.Graphics.DrawString ("现在状态",objFont,objBrush ,nLeft+550,nTop+60);
try
{
objSqlConn=new SqlConnection ("Server=(local);database=atorregulate;user id=sa;password=;");
objSqlConn.Open ();
objSqlCommand=new SqlCommand ("Select * from trigadmininsert",objSqlConn);
objSqlDataReader=objSqlCommand.ExecuteReader ();
int nLine=1;
while(objSqlDataReader.Read ())
{
e.Graphics .DrawString (objSqlDataReader["Auid"].ToString (),objFont,objBrush,nLeft+10,nTop+60+nLine*30);
e.Graphics .DrawString (objSqlDataReader["Aname"].ToString (),objFont,objBrush,nLeft+70,nTop+60+nLine*30);
e.Graphics .DrawString (objSqlDataReader["Aclass"].ToString (),objFont,objBrush,nLeft+110,nTop+60+nLine*30);
e.Graphics .DrawString (objSqlDataReader["Apassword"].ToString (),objFont,objBrush,nLeft+150,nTop+60+nLine*30);
e.Graphics .DrawString (objSqlDataReader["AIDcard"].ToString (),objFont,objBrush,nLeft+190,nTop+60+nLine*30);
e.Graphics .DrawString (objSqlDataReader["Aremark"].ToString (),objFont,objBrush,nLeft+360,nTop+60+nLine*30);
e.Graphics .DrawString (objSqlDataReader["Awritetime"].ToString (),objFont,objBrush,nLeft+400,nTop+60+nLine*30);
e.Graphics .DrawString (objSqlDataReader["Atype"].ToString (),objFont,objBrush,nLeft+550,nTop+60+nLine*30);
nLine++;
}
}
catch(SqlException ex)
{
MessageBox.Show (ex.Message );
}
break;
}
case("住户费用缴交"):
{
objSqlConn=new SqlConnection("database=atorregulate;user id=sa;password=;SERVER=(local)");
objSqlConn.Open();
objSqlDataAdapter=new SqlDataAdapter();
objSqlDataAdapter.SelectCommand=new SqlCommand("select Musername as 业主,Mhomenumber as 房号,Mwater as 水费,Melecticity as 电费, Mcar as 停车费,Mregulate as 管理费,Mrange as 排污费,Mgas as 煤气费,Mdata as 修改日期,Mtype as 状态 from trigfee",objSqlConn);
objDataSet=new DataSet();
objSqlDataAdapter.Fill(objDataSet,"trigfee");
//将DATAGRID控件绑定到数据集表
this.dataGrid1.SetDataBinding(objDataSet,"trigfee");
Font objFont=new Font ("Tahoma",11,FontStyle.Regular );
Brush objBrush=Brushes.Black ;
Pen objPen=new Pen (objBrush);
objPen.Width =2;
int nLeft=this.pageSetupDialog1 .PageSettings .Margins .Left ;
int nTop=this.pageSetupDialog1 .PageSettings .Margins .Top ;
int nWidth=this.pageSetupDialog1 .PageSettings .PaperSize .Width -(this.pageSetupDialog1 .PageSettings .Margins .Left +this.pageSetupDialog1 .PageSettings .Margins .Right );
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -