公司证件管理公司证件管理
1、公司证件管理:
//文件名:CertificateForm.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
namespace MyOffice
{
...
公司证件管理
1、公司证件管理:
//文件名:CertificateForm.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
namespace MyOffice
{
public partial class CertificateForm : Form
{
public CertificateForm()
{
InitializeComponent();
}
private void 公司证件管理BindingNavigatorSaveItem_Click(object sender, EventArgs e)
{
this.Validate();
this.公司证件管理BindingSource.EndEdit();
this.公司证件管理TableAdapter.Update(this.myOfficeDataSet.公司证件管理);
}
private void CertificateForm_Load(object sender, EventArgs e)
{
// TODO: 这行代码将数据加载到
“myOfficeDataSet.公司证件管理”中。您可以根据需要移动或移除它。
this.公司证件管理TableAdapter.Fill(this.myOfficeDataSet.公司证件管理);
}
private void 选择文件Button_Click(object sender, EventArgs e)
{
OpenFileDialog MyDlg = new OpenFileDialog();
if (MyDlg.ShowDialog() == DialogResult.OK)
{
this.存放路径TextBox.Text = MyDlg.FileName;
}
}
private void 显示文件Button_Click(object sender, EventArgs e)
{
Process.Start(this.存放路径TextBox.Text);
}
private void 查询ToolStripButton_Click(object sender, EventArgs e)
{
try
{
this.公司证件管理TableAdapter.FillBy(this.myOfficeDataSet.公司证件管理, new System.Nullable
(((System.DateTime)(System.Convert.ChangeType(开始日期ToolStripTextBox.Text, typeof(System.DateTime))))), new
System.Nullable(((System.DateTime)(System.Convert.ChangeType(结束日期ToolStripTextBox.Text, typeof(System.DateTime))))));
}
catch (System.Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.Message);
}
}
}
}
2、往来信函报表:
//文件名:LetterForm.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics ;
namespace MyOffice
{
public partial class LetterForm : Form
{
public LetterForm()
{
InitializeComponent();
}
private void LetterForm_Load(object sender, EventArgs e)
{
// TODO: 这行代码将数据加载到表“myOfficeDataSet.往来信函管理”中。您可以根据需要移动或移除它。
this.往来信函管理TableAdapter.Fill(this.myOfficeDataSet.往来信函管理);
}
private void 往来信函管理BindingNavigatorSaveItem_Click(object sender, EventArgs e)
{
this.Validate();
this.往来信函管理BindingSource.EndEdit();
this.往来信函管理TableAdapter.Update(this.myOfficeDataSet.往来信函管理);
}
private void 选择文件Button_Click(object sender, EventArgs e)
{
OpenFileDialog MyDlg = new OpenFileDialog();
if (MyDlg.ShowDialog() == DialogResult.OK)
{
this.存放路径TextBox.Text = MyDlg.FileName;
}
}
private void 显示文件Button_Click(object sender, EventArgs e)
{
Process.Start(this.存放路径TextBox.Text);
}
private void 查询ToolStripButton_Click(object sender, EventArgs e)
{
try
{
this.往来信函管理TableAdapter.FillBy(this.myOfficeDataSet.往来信函管理, new System.Nullable(((System.DateTime)(System.Convert.ChangeType(开始日期
ToolStripTextBox.Text, typeof(System.DateTime))))), new System.Nullable(((System.DateTime)(System.Convert.ChangeType(结束日期
ToolStripTextBox.Text, typeof(System.DateTime))))));
}
catch (System.Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.Message);
}
}
}
}
3、登陆
using System;
using System.Collections.Generic; using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace MyOffice
{
public partial class LoginForm : Form
{
public LoginForm()
{
InitializeComponent();
}
//用户登录次数
private int MyTryCount = 0;
private void 登录系统Button_Click(object sender, EventArgs e)
{
//从app.config文件中读取数据库连接字符串信息
String MySQLConnectionString = global::MyOffice.Properties.Settings.Default.MyOfficeConnectionString;
string MySQL = "Select COUNT(*) From 操作权限设置 Where 用户名称=@用户名称 AND 用户密码=@用户密码";
SqlConnection MyConnection = new SqlConnection(MySQLConnectionString);
MyConnection.Open();
SqlCommand MyCommand = new SqlCommand(MySQL, MyConnection);
MyCommand.Parameters.Clear();
SqlParameter MySqlNameParameter = new SqlParameter();
MySqlNameParameter.ParameterName = "@用户名称";
MySqlNameParameter.Value = this.用户名称TextBox.Text;
MyCommand.Parameters.Add(MySqlNameParameter);
SqlParameter MySqlPWParameter = new SqlParameter();
MySqlPWParameter.ParameterName = "@用户密码";
MySqlPWParameter.Value = this.用户密码TextBox.Text;
MyCommand.Parameters.Add(MySqlPWParameter);
int MyCount = (int)MyCommand.ExecuteScalar();
if (MyCount == 1)
{
this.Close();
}
else
{
this.MyTryCount += 1;
if (this.MyTryCount != 3)
{
int MyDoCount = 3 - this.MyTryCount;
MessageBox.Show("用户密码或用户名称有错,还有" + MyDoCount + "次机会~", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
this.用户密码TextBox.Text = "";
this.用户名称TextBox.Text = "";
}
else
{
退出系统Button_Click(null, null);
}
}
if (MyConnection.State == ConnectionState.Open)
{
MyConnection.Close();
}
}
private void 退出系统Button_Click(object sender, EventArgs e)
{
MainForm MyDlg = (MainForm)this.Owner;
MyDlg.Close();
}
}
}
4、操作权限
using System;
using System.Collections.Generic; using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace MyOffice
{
public partial class OperatorForm : Form
{
public OperatorForm()
{
InitializeComponent();
}
private void 操作权限设置BindingNavigatorSaveItem_Click(object sender, EventArgs e)
{
this.Validate();
this.操作权限设置BindingSource.EndEdit();
this.操作权限设置TableAdapter.Update(this.myOfficeDataSet.操作权限设置);
}
private void OperatorForm_Load(object sender, EventArgs e)
{
// TODO: 这行代码将数据加载到表“myOfficeDataSet.操作权限设置”中。您可以根据需要移动或移除它。
this.操作权限设置TableAdapter.Fill(this.myOfficeDataSet.操作权限设置);
}
}
}
5、修改密码
using System;
using System.Collections.Generic; using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace MyOffice
{
public partial class ChangeUserPasswordForm : Form
{
public ChangeUserPasswordForm()
{
InitializeComponent();
}
private void 修改密码Button_Click(object sender, EventArgs e)
{
if (!(this.新密码TextBox.Text == this.再输一次新密码TextBox.Text) || (this.新密码TextBox.Text.Length == 0))
{
MessageBox.Show("两次密码的输入不一致~", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
String MySQLConnectionString =
global::MyOffice.Properties.Settings.Default.MyOfficeConnectionString;
string MySQL = "Update 操作权限设置 Set 用户密码='" + this.新密码TextBox.Text + "' Where 用户名称='" + this.用户名称TextBox.Text + "' AND 用户密码='" + this.旧密码TextBox.Text + "'";
SqlConnection MyConnection = new SqlConnection(MySQLConnectionString);
SqlCommand MyCommand = new SqlCommand(MySQL, MyConnection);
MyCommand.Connection.Open();
int MyCount = MyCommand.ExecuteNonQuery();
if (MyCount == 1)
{
MessageBox.Show("在数据库中修改用户密码操作成功~", "信息提示",
MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
MessageBox.Show("在数据库中修改用户密码操作失败~", "信息提示",
MessageBoxButtons.OK, MessageBoxIcon.Information);
}
if (MyConnection.State == ConnectionState.Open)
{
MyConnection.Close();
}
}
private void 返回系统Button_Click(object sender, EventArgs e)
{
this.Close();
}
}
}
6、突发事故管理:
//文件名:AccidentForm.cs
using System;
using System.Collections.Generic; using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace MyOffice
{
public partial class AccidentForm : Form
{
public AccidentForm()
{
InitializeComponent();
}
private void 出车事故管理BindingNavigatorSaveItem_Click(object sender, EventArgs e)
{
this.Validate();
this.出车事故管理BindingSource.EndEdit();
this.出车事故管理TableAdapter.Update(this.myOfficeDataSet1.出车事故管理);
}
private void AccidentForm_Load(object sender, EventArgs e)
{
// TODO: 这行代码将数据加载到表“myOfficeDataSet1.出车事故管理”中。您可以根据需要移动或移除它。
this.出车事故管理TableAdapter.Fill(this.myOfficeDataSet1.出车事故管理);
String MySQLConnectionString =
global::MyOffice.Properties.Settings.Default.MyOfficeConnectionString;
SqlConnection MyConnection = new SqlConnection(MySQLConnectionString);
MyConnection.Open();
System.Data.DataTable MyQueryTable = new System.Data.DataTable();
string MySQL = "SELECT 车牌号 FROM 车辆登记管理";
SqlDataAdapter MyAdapter = new SqlDataAdapter(MySQL, MyConnection);
MyAdapter.Fill(MyQueryTable);
this.车牌号ComboBox.DataSource = MyQueryTable;
this.车牌号ComboBox.DisplayMember = "车牌号";
this.车牌号ComboBox.ValueMember = "车牌号";
if (MyConnection.State == ConnectionState.Open)
{
MyConnection.Close();
}
}
private void bindingNavigatorAddNewItem_Click(object sender, EventArgs e)
{
//自动计算自编号
String MySQLConnectionString =
global::MyOffice.Properties.Settings.Default.MyOfficeConnectionString;
SqlConnection MyConnection = new SqlConnection(MySQLConnectionString);
MyConnection.Open();
string MySQL = "Select max(自编号) 自编号 From 出车事故管理";
SqlCommand MyCommand = new SqlCommand(MySQL, MyConnection);
object MyResult = MyCommand.ExecuteScalar();
Int64 MyID = 1;
if (MyResult != System.DBNull.Value)
{
String MyMaxID = MyResult.ToString().Trim();
MyMaxID = MyMaxID.Substring(2, MyMaxID.Length - 2);
MyID = Convert.ToInt64(MyMaxID) + 1;
}
int MyLength = MyID.ToString().Length;
string MyNewID = "";
switch (MyLength)
{
case 1:
MyNewID = "SG0000000" + MyID.ToString();
break;
case 2:
MyNewID = "SG000000" + MyID.ToString();
break;
case 3:
MyNewID = "SG00000" + MyID.ToString();
break;
case 4:
MyNewID = "SG0000" + MyID.ToString();
break;
case 5:
MyNewID = "SG000" + MyID.ToString();
break;
case 6:
MyNewID = "SG00" + MyID.ToString();
break;
case 7:
MyNewID = "SG0" + MyID.ToString();
break;
}
this.自编号TextBox.Text = MyNewID;
}
private void 查询ToolStripButton_Click(object sender, EventArgs e)
{
try
{
this.出车事故管理TableAdapter.FillBy(this.myOfficeDataSet1.出车事故管理, new System.Nullable(((System.DateTime)(System.Convert.ChangeType(开始日期
ToolStripTextBox.Text, typeof(System.DateTime))))), new System.Nullable(((System.DateTime)(System.Convert.ChangeType(结束日期
ToolStripTextBox.Text, typeof(System.DateTime))))));
}
catch (System.Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.Message);
}
}
}
}
本文档为【公司证件管理】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑,
图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。