計(jì)算機(jī)畢業(yè)論文源代碼:會(huì)計(jì)信息生產(chǎn)社會(huì)化仿真系統(tǒng)
1.折舊年限表(company_zjnx)建表源程序:
CREATE TABLE [dbo].[company_zjnx] (
[cname] [char] (40) COLLATE Chinese_PRC_CI_AS NULL ,
[obj_name] [char] (40) COLLATE Chinese_PRC_CI_AS NULL ,
[zj_years] [int] NULL ,
[zj_idea] [char] (40) COLLATE Chinese_PRC_CI_AS NULL ,
[canzhi] [float] NULL
)
2.企業(yè)基本情況表(company_total)建表源程序:
CREATE TABLE [dbo].[company_total] (
[com_id] [int] NOT NULL ,
[cname] [char] (40) COLLATE Chinese_PRC_CI_AS NOT NULL ,
[ccode] [char] (18) COLLATE Chinese_PRC_CI_AS NULL ,
[rmoney] [float] NULL ,
[faren] [char] (8) COLLATE Chinese_PRC_CI_AS NULL ,
[cadd] [char] (40) COLLATE Chinese_PRC_CI_AS NULL ,
[kinds] [char] (20) COLLATE Chinese_PRC_CI_AS NULL ,
[act_area] [text] COLLATE Chinese_PRC_CI_AS NULL ,
[tel] [char] (12) COLLATE Chinese_PRC_CI_AS NULL ,
[cell] [char] (11) COLLATE Chinese_PRC_CI_AS NULL ,
[fax] [char] (12) COLLATE Chinese_PRC_CI_AS NULL ,
[ccontent] [char] (8) COLLATE Chinese_PRC_CI_AS NULL ,
[bank] [char] (30) COLLATE Chinese_PRC_CI_AS NULL ,
[bank_num] [char] (18) COLLATE Chinese_PRC_CI_AS NULL ,
[zz_num] [char] (12) COLLATE Chinese_PRC_CI_AS NULL ,
[tax_num] [char] (15) COLLATE Chinese_PRC_CI_AS NULL ,
[realmoney] [float] NULL ,
[zz_years] [int] NULL ,
[fz_date] [char] (8) COLLATE Chinese_PRC_CI_AS NULL ,
[fz_jiguan] [char] (30) COLLATE Chinese_PRC_CI_AS NULL ,
[hangye] [char] (10) COLLATE Chinese_PRC_CI_AS NULL
)
3.企業(yè)初始投資表(company_cstz)見(jiàn)表源程序:
CREATE TABLE [dbo].[company_cstz] (
[cname] [char] (40) COLLATE Chinese_PRC_CI_AS NOT NULL ,
[cz_pro] [char] (40) COLLATE Chinese_PRC_CI_AS NULL ,
[cz_money] [real] NULL ,
[cz_man] [char] (20) COLLATE Chinese_PRC_CI_AS NULL ,
[cz_code] [char] (10) COLLATE Chinese_PRC_CI_AS NULL ,
[cz_date] [char] (10) COLLATE Chinese_PRC_CI_AS NULL ,
[cz_percent] [char] (10) COLLATE Chinese_PRC_CI_AS NULL ,
[extra] [char] (60) COLLATE Chinese_PRC_CI_AS NULL
)
4.交易總表(contract_total)建表源程序:
CREATE TABLE [dbo].[contract_total] (
[y] [char] (10) COLLATE Chinese_PRC_CI_AS NULL ,
[m] [char] (10) COLLATE Chinese_PRC_CI_AS NULL ,
[d] [char] (10) COLLATE Chinese_PRC_CI_AS NULL ,
[gname] [char] (40) COLLATE Chinese_PRC_CI_AS NULL ,
[gtax_num] [char] (15) COLLATE Chinese_PRC_CI_AS NULL ,
[g_add] [char] (40) COLLATE Chinese_PRC_CI_AS NULL ,
[gbank_num] [char] (18) COLLATE Chinese_PRC_CI_AS NULL ,
[obj_bh] [char] (10) COLLATE Chinese_PRC_CI_AS NULL ,
[obj_name] [char] (20) COLLATE Chinese_PRC_CI_AS NULL ,
[obj_dw] [char] (8) COLLATE Chinese_PRC_CI_AS NULL ,
[obj_sl] [int] NULL ,
[obj_dj] [real] NULL ,
[jine] [float] NULL ,
[tax_per] [decimal](18, 0) NULL ,
[taxe] [float] NULL ,
[jshj] [float] NULL ,
[xname] [char] (40) COLLATE Chinese_PRC_CI_AS NULL ,
[xtax_num] [char] (15) COLLATE Chinese_PRC_CI_AS NULL ,
[x_add] [char] (40) COLLATE Chinese_PRC_CI_AS NULL ,
[xbank_num] [char] (18) COLLATE Chinese_PRC_CI_AS NULL ,
[zj_years] [int] NULL ,
[zj_idear] [char] (40) COLLATE Chinese_PRC_CI_AS NULL ,
[canzhi] [float] NULL ,
[pz_num] [int] NULL ,
[zy] [char] (30) COLLATE Chinese_PRC_CI_AS NULL
)
5.科目表(kmb)建表源程序:
CREATE TABLE [dbo].[kmb] (
[km_num] [char] (15) COLLATE Chinese_PRC_CI_AS NULL ,
[km_name] [char] (26) COLLATE Chinese_PRC_CI_AS NULL ,
[km_xzh] [char] (10) COLLATE Chinese_PRC_CI_AS NULL ,
[jdfx] [char] (2) COLLATE Chinese_PRC_CI_AS NULL ,
[km_jb] [int] NULL
)
6.記賬憑證表(jzpz)建表源程序:
CREATE TABLE [dbo].[jzpz] (
[y] [char] (10) COLLATE Chinese_PRC_CI_AS NULL ,
[m] [char] (10) COLLATE Chinese_PRC_CI_AS NULL ,
[d] [char] (10) COLLATE Chinese_PRC_CI_AS NULL ,
[pz_num] [int] NULL ,
[z_cname] [char] (40) COLLATE Chinese_PRC_CI_AS NULL ,
[d_cname] [char] (40) COLLATE Chinese_PRC_CI_AS NULL ,
[km_num] [char] (10) COLLATE Chinese_PRC_CI_AS NULL ,
[km_name] [char] (26) COLLATE Chinese_PRC_CI_AS NULL ,
[mxkm] [char] (26) COLLATE Chinese_PRC_CI_AS NULL ,
[zy] [char] (30) COLLATE Chinese_PRC_CI_AS NULL ,
[j_jine] [float] NULL ,
[d_jine] [float] NULL
)
7.時(shí)間維表(time_dim)建表源程序:
CREATE TABLE [dbo].[time_dim] (
[time_num] [int] IDENTITY (1, 1) NOT NULL ,
[y] [char] (10) COLLATE Chinese_PRC_CI_AS NULL ,
[m] [char] (10) COLLATE Chinese_PRC_CI_AS NULL ,
[d] [char] (10) COLLATE Chinese_PRC_CI_AS NULL
)
8.貨物維表(obj_dim)建表源程序:
CREATE TABLE [dbo].[obj_dim] (
[obj_num] [int] IDENTITY (1, 1) NOT NULL ,
[obj_bh] [char] (10) COLLATE Chinese_PRC_CI_AS NOT NULL ,
[obj_name] [char] (20) COLLATE Chinese_PRC_CI_AS NOT NULL ,
[obj_dw] [char] (8) COLLATE Chinese_PRC_CI_AS NOT NULL ,
[obj_dj] [real] NOT NULL
)
9.購(gòu)貨單位維表(g_dim)建表源程序:
CREATE TABLE [dbo].[g_dim] (
[g_num] [int] IDENTITY (1, 1) NOT NULL ,
[gname] [char] (40) COLLATE Chinese_PRC_CI_AS NOT NULL ,
[gtax_num] [char] (15) COLLATE Chinese_PRC_CI_AS NULL ,
[g_add] [char] (40) COLLATE Chinese_PRC_CI_AS NULL ,
[gbank_num] [char] (18) COLLATE Chinese_PRC_CI_AS NULL
)
10.銷貨單位維表(x_dim)建表源程序:
CREATE TABLE [dbo].[x_dim] (
[x_num] [int] IDENTITY (1, 1) NOT NULL ,
[xname] [char] (40) COLLATE Chinese_PRC_CI_AS NOT NULL ,
[xtax_num] [char] (15) COLLATE Chinese_PRC_CI_AS NULL ,
[x_add] [char] (40) COLLATE Chinese_PRC_CI_AS NULL ,
[xbank_num] [char] (18) COLLATE Chinese_PRC_CI_AS NULL
)
11.交易事實(shí)表(contract_total)建表源程序:
CREATE TABLE [dbo].[contract_fact] (
[s_num] [int] IDENTITY (1, 1) NOT NULL ,
[g_num] [int] NOT NULL ,
[x_num] [int] NOT NULL ,
[time_num] [int] NOT NULL ,
[obj_num] [int] NOT NULL ,
[obj_sl] [int] NOT NULL ,
[jine] [float] NOT NULL ,
[tax_per] [decimal](18, 0) NOT NULL ,
[taxe] [float] NOT NULL ,
[jshj] [float] NOT NULL
)
計(jì)算機(jī)畢業(yè)論文源代碼:企業(yè)人事管理系統(tǒng)的設(shè)計(jì)與實(shí)現(xiàn)
各模塊實(shí)現(xiàn)的主要源代碼
F1.1登錄模塊的設(shè)計(jì)與實(shí)現(xiàn)的主要代碼
if (tbxUserCode.Text.Trim() == "")
{
BigMessageBox.Show("請(qǐng)您輸入用戶或密碼!!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Stop);
this.tbxUserCode.Text = "";
this.tbxUserCode.Text = "";
this.tbxUserCode.Focus();
return;
}
else
{
EmployeeInfo emp = null;
switch (User.LoginValidate(tbxUserCode.Text.Trim(), tbxUserPwd.Text.Trim(), out emp))
{
case User.LoginResult.NoUser:
{
BigMessageBox.Show("沒(méi)有該用戶信息", "用戶驗(yàn)證", MessageBoxButtons.OK, MessageBoxIcon.Stop);
tbxUserCode.Text = "";
tbxUserCode.Focus();
break;
}
case User.LoginResult.PasswordError:
{
BigMessageBox.Show("用戶密碼錯(cuò)誤!!", "用戶驗(yàn)證", MessageBoxButtons.OK, MessageBoxIcon.Stop);
tbxUserPwd.Text = "";
tbxUserPwd.Focus();
break;
}
case User.LoginResult.Success:
{
FormMain objMain = new FormMain();
this.Hide();
objMain.Show();
break;
}
default:
break;
}
}
F1.2登陸實(shí)體類:
StringBuilder strSql = new StringBuilder();
strSql.Append("select EmpID, LoginName, LoginCode, Password, RoleID, IsUsed, CreateName,CreateDatetime,Remark FROM Login ");
strSql.Append(" where LoginrCode=" + LoginrCode);
Login model = new Login();
DataTable dt = DbHelperSQL.Instance.GetDataTable(strSql.ToString());
if (dt.Rows.Count > 0)
{
model.EmpNO = dt.Rows[0]["EmpNO"].ToString();
model.LoginName = dt.Rows[0]["LoginName"].ToString();
model.LoginrCode = dt.Rows[0]["LoginCode"].ToString();
model.Password = dt.Rows[0]["Password"].ToString();
if (dt.Rows[0]["RoleID"].ToString() != "")
{
model.RoleID = int.Parse(dt.Rows[0]["RoleID"].ToString());
}
model.IsUsed = dt.Rows[0]["IsUsed"].ToString();
model.CreateName = dt.Rows[0]["CreateName"].ToString();
if (dt.Rows[0]["CreateDatetime"].ToString() != "")
{
model.CreateDatetime = DateTime.Parse(dt.Rows[0]["CreateDatetime"].ToString());
}
model.Remark = dt.Rows[0]["Remark"].ToString();
return model;
}
else
{
return null;
}
檢查該員工是否應(yīng)該是系統(tǒng)用戶:
return DbHelperSQL.Instance.ExecuteScalar("SELECT LoginID FROM Login WHERE LoginCode= " + LoginrCode + "");
檢查用戶編碼是否可以使用:
return DbHelperSQL.Instance.ExecuteScalar("SELECT LoginrCode FROM Login WHERE LoginCode=" + LoginrCode + "");
通過(guò)LoginID查找相應(yīng)的密碼:return DbHelperSQL.Instance.ExecuteScalar("Select Password from Login Where LoginID = " + LoginID);
F1.3 員工管理模塊的設(shè)計(jì)與實(shí)現(xiàn)的主要代碼
F1.3.1員工管理實(shí)現(xiàn)的主要代碼:
public class BllAttendance
{
///
/// 增加一條數(shù)據(jù)
///
public static int Add(Attendance model, DbTransaction trans)
{
StringBuilder sb = new StringBuilder();
sb.Append("INSERT INTO Attendance(AttenDate, EmpNo, Adsum, Fact, Late, Leave, Absent, Overtime, NotIn, NotOut, Outgo,");
sb.Append("WorkOut, WorkTime, NumCount, [In], Out, Artificial, [Work], Illness, Thing, Family)");
sb.Append("VALUES (@AttenDate, @EmpNo,@Adsum, @Fact, @Late, @Leave, @Absent, @Overtime, @NotIn, @NotOut, @Outgo,");
sb.Append(" @WorkOut, @WorkTime, @NumCount, @In,@Out,@Artificial, @Work, @Illness, @Thing, @Family)");
return DbHelperSQL.Instance.ExcuteTransNonQuery(sb.ToString(), DbHelperSQL.Instance.CreateParamters(sb.ToString(), model), trans);
}
///
/// 更新一條數(shù)據(jù)
///
public static int Update(Attendance model)
{
StringBuilder sb = new StringBuilder();
sb.Append("UPDATE Attendance SET Adsum=@Adsum, Fact =@Fact, Late =@Late, Leave =@Leave, Absent =@Absent, Overtime =@Overtime,");
sb.Append(" NotIn =@NotIn, NotOut =@NotOut, Outgo =@Outgo, WorkOut =@WorkOut, WorkTime =@WorkTime, NumCount =@NumCount,");
sb.Append(" [In] =@In, Artificial =@Artificial, Out =@Out, [Work] =@Work,Illness =@Illness, Thing =@Thing, Family =@Family WHERE EmpNo =@EmpNo");
return DbHelperSQL.Instance.ExcuteNonQuery(sb.ToString(), DbHelperSQL.Instance.CreateParamters(sb.ToString(), model));
}
///
/// 刪除一條數(shù)據(jù)
///
public static int Delete(string EmpNo)
{
StringBuilder sb = new StringBuilder();
sb.Append(String.Format("DELETE FROM Attendance WHERE EmpNo={0}", EmpNo));
return DbHelperSQL.Instance.ExcuteNonQuery(sb.ToString());
}
public static DataTable GetAttenddanceDataTable()
{
StringBuilder sb = new StringBuilder();
sb.Append("SELECT AttenDate, EmpNo, Adsum, Fact, Late, Leave, Absent, Overtime, NotIn, NotOut,");
sb.Append(" Outgo, WorkOut, WorkTime, NumCount, [In], Out, Artificial, [Work], Illness, Thing,Family FROM Attendance ");
return DbHelperSQL.Instance.GetDataTable(sb.ToString());
}
F1.3.2 部門管理實(shí)現(xiàn)主要代碼:
public class BLLDepartment
{
///
/// 增加一條數(shù)據(jù)
///
public static int Add(Department model)
{
StringBuilder strSql = new StringBuilder();
strSql.Append(" into Department(");
strSql.Append("DepartNo,DepartName,DepartDesn,ParentID,Remark");
strSql.Append(")");
strSql.Append(" values (");
strSql.Append("" + model.DepartNo + ",");
strSql.Append("" + model.DepartName + ",");
strSql.Append("" + model.DepartDesn + ",");
strSql.Append("" + model.ParentID + ",");
strSql.Append("" + model.Remark + "");
strSql.Append(")");
return DbHelperSQL.Instance.ExcuteNonQuery(strSql.ToString());
}
///
/// 更新一條數(shù)據(jù)
///
public static int Update(Department model)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("Department set ");
strSql.Append("DepartName=" + model.DepartName + ",");
strSql.Append("DepartDesn=" + model.DepartDesn + ",");
strSql.Append("ParentID=" + model.ParentID + ",");
strSql.Append("Remark=" + model.Remark + "");
strSql.Append(" where DepartNo=" + model.DepartNo + " ");
return DbHelperSQL.Instance.ExcuteNonQuery(strSql.ToString());
}
///
/// 刪除一條數(shù)據(jù)
///
public static int Delete(string DepartNo)
{
StringBuilder strSql = new StringBuilder();
strSql.Append(" Department ");
strSql.Append(" where DepartNo=" + DepartNo + " ");
return DbHelperSQL.Instance.ExcuteNonQuery(strSql.ToString());
}
///
/// 得到一個(gè)對(duì)象實(shí)體
///
public static Department GeDepartment(string DepartNo)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("SELECT DepartNo, DepartName, DepartDesn, ParentID, Remark FROM Department");
strSql.Append(" WHERE DepartNo=" + DepartNo);
Department model = new Department();
DataTable dt = DbHelperSQL.Instance.GetDataTable(strSql.ToString());
if (dt.Rows.Count > 0)
{
model.DepartNo = dt.Rows[0]["DepartNo"].ToString();
model.DepartName = dt.Rows[0]["DepartName"].ToString();
model.DepartDesn = dt.Rows[0]["DepartDesn"].ToString();
if (dt.Rows[0]["ParentID"].ToString() != "")
{
model.ParentID = int.Parse(dt.Rows[0]["ParentID"].ToString());
}
model.Remark = dt.Rows[0]["Remark"].ToString();
return model;
}
else
{
return null;
}
}
public static string GetDepartmentIDIsNull(int empID)
{
return DbHelperSQL.Instance.ExecuteScalar("SELECT DepartmentID FROM Employee WHERE DepartmentID=" + empID + "");
}
}
F1.3.3工資管理主要代碼:
public partial class UcPay : UserControl
{
private string empNo = "";
public UcPay()
{
InitializeComponent();
}
private void btnExit_Click(object sender, EventArgs e)
{
(this.Parent as Panel).Controls.Clear();
}
private void btnAdd_Click(object sender, EventArgs e)
{
if (BLLGongZ.Add(GetGongZ()) > 0)
{
BigMessageBox.Show("員工工資添加成功", "員工工資維護(hù)", MessageBoxButtons.OK, MessageBoxIcon.Information);
this.Bind();
}
else
{
BigMessageBox.Show("員工工資添加失敗!!", "員工工資維護(hù)", MessageBoxButtons.OK, MessageBoxIcon.Stop);
}
}
private GongZ GetGongZ()
{
GongZ model = new GongZ();
model.EmpNO = empNo;
model.MonthID = Utilities.ConverObjectInt(cboMonth.SelectedValue);
model.GBGZ = Convert.ToDecimal(txtGBGZ.Text.Trim());
model.FZYJ = Convert.ToDecimal(txtFZYJ.Text.Trim());
model.XSTC = Convert.ToDecimal(txtXSTC.Text.Trim());
model.BJGZ = Convert.ToDecimal(txtBJGZ.Text.Trim());
model.JXGZ = Convert.ToDecimal(txtJXGZ.Text.Trim());
model.SJGZ = Convert.ToDecimal(txtSJGZ.Text.Trim());
model.JLGZ = Convert.ToDecimal(txtJLGZ.Text.Trim());
model.YLBX = Convert.ToDecimal(txtYLBX.Text.Trim());
model.JBGZ = Convert.ToDecimal(txtJBGZ.Text.Trim());
model.ZSGZ = Convert.ToDecimal(txtZSGZ.Text.Trim());
model.QQJJ = Convert.ToDecimal(txtQQJJ.Text.Trim());
model.GSKF = Convert.ToDecimal(txtGSKF.Text.Trim());
model.OTHER = Convert.ToDecimal(ttxtOTHER.Text.Trim());
model.NOTES = "";
return model;
}
private void UcPay_Load(object sender, EventArgs e)
{
this.cboMonth.DisplayMember = "CDesc";
this.cboMonth.ValueMember = "CodeID";
this.cboMonth.DataSource = BLLGongZ.GetMonth();
this.cboMonth.SelectedIndex = 0;
this.dgEmp.DataSource = BLLGongZ.GetEmpInfo();
this.Bind();
}
private void dgEmp_CellClick(object sender, DataGridViewCellEventArgs e)
{
if (dgEmp.DataSource != null && dgEmp.Rows.Count > 0)
{
if (e.RowIndex != -1)
{
empNo = this.dgEmp.Rows[e.RowIndex].Cells[0].Value.ToString();
this.Bind();
}
}
}
private void btnUpdate_Click(object sender, EventArgs e)
{
if (BLLGongZ.Update(GetGongZ()) > 0)
{
BigMessageBox.Show("員工工資添加成功", "員工工資維護(hù)", MessageBoxButtons.OK, MessageBoxIcon.Information);
this.Bind();
}
else
{
BigMessageBox.Show("員工工資添加失敗!!", "員工工資維護(hù)", MessageBoxButtons.OK, MessageBoxIcon.Stop);
}
}
private void Bind()
{
this.dgvSalaryItem.DataSource = BLLGongZ.GetGongZ(empNo);
}
private void dgvSalaryItem_CellClick(object sender, DataGridViewCellEventArgs e)
{
if (dgvSalaryItem.DataSource != null && dgvSalaryItem.Rows.Count > 0)
{
if (e.RowIndex != -1)
{
empNo = this.dgvSalaryItem.Rows[e.RowIndex].Cells["empID"].Value.ToString();
cboMonth.SelectedValue = this.dgvSalaryItem.Rows[e.RowIndex].Cells["MonthID"].Value;
txtGBGZ.Text = this.dgvSalaryItem.Rows[e.RowIndex].Cells["GBGZ"].Value.ToString();
txtFZYJ.Text = this.dgvSalaryItem.Rows[e.RowIndex].Cells["FZYJ"].Value.ToString();
txtXSTC.Text = this.dgvSalaryItem.Rows[e.RowIndex].Cells["XSTC"].Value.ToString();
txtBJGZ.Text = this.dgvSalaryItem.Rows[e.RowIndex].Cells["BJGZ"].Value.ToString();
txtJXGZ.Text = this.dgvSalaryItem.Rows[e.RowIndex].Cells["JXGZ"].Value.ToString();
txtSJGZ.Text = this.dgvSalaryItem.Rows[e.RowIndex].Cells["SJGZ"].Value.ToString();
txtJLGZ.Text = this.dgvSalaryItem.Rows[e.RowIndex].Cells["JLGZ"].Value.ToString();
txtYLBX.Text = this.dgvSalaryItem.Rows[e.RowIndex].Cells["YLBX"].Value.ToString();
txtJBGZ.Text = this.dgvSalaryItem.Rows[e.RowIndex].Cells["JBGZ"].Value.ToString();
txtZSGZ.Text = this.dgvSalaryItem.Rows[e.RowIndex].Cells["ZSGZ"].Value.ToString();
txtQQJJ.Text = this.dgvSalaryItem.Rows[e.RowIndex].Cells["QQJJ"].Value.ToString();
txtGSKF.Text = this.dgvSalaryItem.Rows[e.RowIndex].Cells["GSKF"].Value.ToString();
ttxtOTHER.Text = this.dgvSalaryItem.Rows[e.RowIndex].Cells["OTHER"].Value.ToString();
}
}
}
private void btnDelete_Click(object sender, EventArgs e)
{
if (empNo != "")
{
if (BigMessageBox.Show("您確定要?jiǎng)h除員工基本信息嗎?", "刪除員工工資信息", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
{
if (BLLGongZ.Delete(empNo) > 0)
{
BigMessageBox.Show("刪除員工工資信息成功", "刪除員工工資信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
this.Bind();
}
else
{
BigMessageBox.Show("刪除員工考評(píng)信息失敗", "刪除員工工資信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
else
{
BigMessageBox.Show("請(qǐng)選擇一個(gè)員工信息", "刪除員工工資信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
F1.3.4考勤信息設(shè)計(jì)與實(shí)現(xiàn)主要代碼:
private void btnAdd_Click(object sender, EventArgs e)
{
if (BllEvaluation.Add(GetEvaluation()) > 0)
{
BigMessageBox.Show("添加員工考評(píng)信息成功", "添加員工考評(píng)信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
Bind();
Init();
}
else
{
BigMessageBox.Show("添加員工考評(píng)信息失敗", "添加員工考評(píng)信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
private Evaluation GetEvaluation()
{
Evaluation model = new Evaluation();
if (Utilities.ConvertNullToSpace(cboMonth.SelectedValue) != "")
{
model.EvaMonth = Utilities.ConvertInt(cboMonth.SelectedValue.ToString());
}
if (Utilities.ConvertNullToSpace(cboGrade.SelectedValue) != "")
{
model.MarkDegreeID = Utilities.ConvertInt(cboGrade.SelectedValue.ToString());
}
model.Invigilater = txtPerson.Text;
model.EmployeeNO = labEmpID.Text.Trim();
model.Mark = Utilities.ConvertInt(this.txtNumber.Text);
model.Remark = this.txtRemark.Text;
model.Result = this.txtResult.Text;
model.Subject = this.txtProject.Text;
if(labID.Text.Trim()!="")
{
model.EvaluationID = int.Parse(labID.Text.Trim());
}
return model;
}
private void btnUpdate_Click(object sender, EventArgs e)
{
if (labID.Text.Trim()!="")
{
if (BllEvaluation.Update(GetEvaluation()) > 0)
{
BigMessageBox.Show("修改員工考評(píng)信息成功", "修改員工考評(píng)信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
this.dgvAssess.DataSource = ComBoxDataTable.GetAssessTable(labEmpID.Text.Trim());
Init();
}
else
{
BigMessageBox.Show("修改員工考評(píng)信息失敗", "修改員工考評(píng)信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
else
{
BigMessageBox.Show("請(qǐng)選擇一個(gè)員工的考評(píng)信息", "修改員工考評(píng)信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
private void btnDelete_Click(object sender, EventArgs e)
{
if (!Utilities.ConvertNullToSpace(this.dgvAssess.Rows[this.dgvAssess.CurrentRow.Index].Cells["EvaluationID"]).Equals(""))
{
if (BllEvaluation.Delete(Utilities.ConvertInt(this.dgvAssess.Rows[this.dgvAssess.CurrentRow.Index].Cells["EvaluationID"].Value.ToString()))>0)
{
BigMessageBox.Show("刪除員工考評(píng)信息成功", "刪除員工考評(píng)信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
this.dgvAssess.DataSource = ComBoxDataTable.GetAssessTable(labEmpID.Text.Trim());
Init();
}
else
{
BigMessageBox.Show("刪除員工考評(píng)信息失敗", "刪除員工考評(píng)信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
else
{
BigMessageBox.Show("請(qǐng)選擇一個(gè)員工的考評(píng)信息", "刪除員工考評(píng)信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
private void dgvEmp_CellClick(object sender, DataGridViewCellEventArgs e)
{
if (dgvEmp.DataSource != null && dgvEmp.Rows.Count > 0)
{
labEmpID.Text = this.dgvEmp.Rows[e.RowIndex].Cells["EmployeeNO"].Value.ToString();
this.dgvAssess.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
this.dgvAssess.DataSource = ComBoxDataTable.GetAssessTable(this.dgvEmp.Rows[e.RowIndex].Cells["EmployeeNO"].Value.ToString());
this.btnAdd.Enabled = true;
}
}
private void dgvAssess_CellClick(object sender, DataGridViewCellEventArgs e)
{
if (dgvAssess.DataSource != null && dgvAssess.Rows.Count > 0)
{
labID.Text = this.dgvAssess.Rows[e.RowIndex].Cells["EvaluationID"].Value.ToString();
this.btnUpdate.Enabled = true;
this.btnDelete.Enabled = true;
this.txtNumber.Text = Utilities.ConvertNullToSpace(this.dgvAssess.Rows[e.RowIndex].Cells["Mark"].Value);
this.txtProject.Text = Utilities.ConvertNullToSpace(this.dgvAssess.Rows[e.RowIndex].Cells["Subject"].Value);
this.txtRemark.Text = Utilities.ConvertNullToSpace(this.dgvAssess.Rows[e.RowIndex].Cells["Remark"].Value);
this.txtResult.Text = Utilities.ConvertNullToSpace(this.dgvAssess.Rows[e.RowIndex].Cells["Result"].Value);
this.cboGrade.Text = Utilities.ConvertNullToSpace(this.dgvAssess.Rows[e.RowIndex].Cells["MarkDegreeID"].Value);
this.cboMonth.Text = Utilities.ConvertNullToSpace(this.dgvAssess.Rows[e.RowIndex].Cells["EvaMonth"].Value);
this.txtPerson.Text = Utilities.ConvertNullToSpace(this.dgvAssess.Rows[e.RowIndex].Cells["Invigilater"].Value);
}
}
private void btnClean_Click(object sender, EventArgs e)
{
Init();
}
F1.4 數(shù)據(jù)訪問(wèn)類:
public class BllExperience
{
public BllExperience(){}
///
/// 增加一條數(shù)據(jù)
///
public static int Add(Experience model)
{
StringBuilder strSql = new StringBuilder();
strSql.Append(" into Experience(");
strSql.Append("Position,Department,StartDate,EndDate,EmployeeNO,Remark");
strSql.Append(")");
strSql.Append(" values (");
strSql.Append("" + model.Position + ",");
strSql.Append("" + model.Department + ",");
strSql.Append("" + model.StartDate + ",");
strSql.Append("" + model.EndDate + ",");
strSql.Append("" + model.EmployeeNO + ",");
strSql.Append("" + model.Remark + "");
strSql.Append(")");
return DbHelperSQL.Instance.ExcuteNonQuery(strSql.ToString());
}
///
/// 更新一條數(shù)據(jù)
///
public static int Update(Experience model)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("Experience set ");
strSql.Append("Position=" + model.Position + ",");
strSql.Append("Department=" + model.Department + ",");
strSql.Append("StartDate=" + model.StartDate + ",");
strSql.Append("EndDate=" + model.EndDate + ",");
strSql.Append("EmployeeNO=" + model.EmployeeNO + ",");
strSql.Append("Remark=" + model.Remark + "");
strSql.Append(" WHERE ExperienceID=" + model.ExperienceID + "");
return DbHelperSQL.Instance.ExcuteNonQuery(strSql.ToString());
}
///
/// 刪除一條數(shù)據(jù)
///
public static int Delete(int ExperienceID)
{
StringBuilder strSql = new StringBuilder();
strSql.Append(" Experience ");
strSql.Append(" where ExperienceID=" + ExperienceID);
return DbHelperSQL.Instance.ExcuteNonQuery(strSql.ToString());
}
///
/// 得到一個(gè)對(duì)象實(shí)體
///
public Experience GetModel(int ExperienceID)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("select ");
strSql.Append(" [ExperienceID],[Position],[Department],[StartDate],[EndDate],[EmployeeID],[Remark] ");
strSql.Append(" from Experience ");
strSql.Append(" where ExperienceID=" + ExperienceID);
Experience model = new Experience();
DataTable dt = DbHelperSQL.Instance.GetDataTable(strSql.ToString());
model.ExperienceID = ExperienceID;
if (dt.Rows.Count > 0)
{
model.Position = dt.Rows[0]["Position"].ToString();
model.Department = dt.Rows[0]["Department"].ToString();
if (dt.Rows[0]["StartDate"].ToString() != "")
{
model.StartDate = DateTime.Parse(dt.Rows[0]["StartDate"].ToString());
}
if (dt.Rows[0]["EndDate"].ToString() != "")
{
model.EndDate = DateTime.Parse(dt.Rows[0]["EndDate"].ToString());
}
if (dt.Rows[0]["EmployeeID"].ToString() != "")
{
model.EmployeeNO = dt.Rows[0]["EmployeeID"].ToString();
}
model.Remark = dt.Rows[0]["Remark"].ToString();
return model;
}
else
{
return null;
}
}
}
F1.5生日提醒主要代碼:
獲得當(dāng)天生日的員工名稱
StringBuilder sb = new StringBuilder();
sb.Append("SELECT EmployName FROM EMPLOYEE ");
sb.Append("WHERE CAST(MONTH(BIRTHDAY) AS VARCHAR(2))+CAST(DAY(BIRTHDAY) AS VARCHAR(2))=CAST(MONTH(GETDATE()) AS VARCHAR(2))+CAST(DAY(GETDATE()) AS VARCHAR(2))");
return DbHelperSQL.Instance.GetDataTable(sb.ToString());
F1.6啟動(dòng)第三方EXE文件操作類:
public class Tools
{
///
/// 啟動(dòng)數(shù)據(jù)庫(kù)備份
///
public static void DataBak()
{
System.Diagnostics.Process.Start("BACKUP.exe");
}
///
/// 計(jì)算器
///
public static void Computer()
{
System.Diagnostics.Process.Start("calc.exe");
}
///
/// 啟動(dòng)畫圖工具
///
public static void Img()
{
System.Diagnostics.Process.Start("mspaint.exe");
}
///
/// 記事本
///
public static void OpenNotepad()
{
System.Diagnostics.Process.Start("Notepad.exe");
}
}
[計(jì)算機(jī)畢業(yè)論文源代碼]