public static EmployeePO DOToPO(EmployeeDO from) { EmployeePO to = new EmployeePO(); to.EmployeeId = from.EmployeeId; to.LastName = from.LastName; to.FirstName = from.FirstName; to.Title = from.Title; to.TitleOfCourtesy = from.TitleOfCourtesy; to.BirthDate = from.BirthDate; to.HireDate = from.HireDate; to.Address = from.Address; to.City = from.City; to.Region = from.Region; to.PostalCode = from.PostalCode; to.Country = from.Country; to.HomePhone = from.HomePhone; to.Extension = from.Extension; //Removed photo to.Notes = from.Notes; to.ReportsTo = from.ReportsTo; to.PhotoPath = from.PhotoPath; to.Username = from.Username; to.Password = from.Password; to.Role = from.Role; return(to); }
private void frmPunish_Load(object sender, EventArgs e) { Refresh(); departmentDO = new DepartmentDO(); employeeDO = new EmployeeDO(); departmentTreeView.DepartmentDataSet = departmentDO.GetAllDepartments(); departmentTreeView.BuildTree(); departmentTreeView.SelectedNode = departmentTreeView.TopNode; departmentTreeView.ExpandNodes(true); LoadPunishCardCombo(); punishD0 = new PunishDO(); dtPunish = dsPunish.Tables[0]; if (selectedPunish >= 0) //Sửa thông tin thẻ phạt { //this.Text = "Sửa thông tin thiết lập thẻ phạt"; this.Text = WorkingContext.LangManager.GetString("frmPunish_Text1"); LoadPunishData(); cboEmployeeName.Enabled = false; departmentTreeView.Enabled = false; } else // thêm mới { //This.Text = "Thiết lập thẻ phạt"; this.Text = WorkingContext.LangManager.GetString("frmPunish_Text2"); } }
private void frmRegLeaveSchedule_Load(object sender, EventArgs e) { Refresh(); employeeDO = new EmployeeDO(); departnemtDO = new DepartmentDO(); departmentTreeView.DepartmentDataSet = departnemtDO.GetAllDepartments(); departmentTreeView.BuildTree(); departmentTreeView.SelectedNode = departmentTreeView.TopNode; departmentTreeView.ExpandNodes(true); leaveScheduleDO = new LeaveScheduleDO(); if (selectedLeaveSchedule >= 0) { // disable các thuộc tính liên quan đến nhân viên string str = WorkingContext.LangManager.GetString("frmRegLeaveSchedule_Text2"); this.Text = str; //this.Text = "Sửa đăng ký công tác"; LoadLeaveSchedule(); cboEmployeeName.Enabled = false; departmentTreeView.Enabled = false; } else { string str = WorkingContext.LangManager.GetString("frmRegLeaveSchedule_Text"); this.Text = str; dsLeaveSchedule = leaveScheduleDO.getLeaveSchedule(); } }
private void btnDeletedEmployee_Click(object sender, System.EventArgs e) { if (delete == 0) { // btnAdd.Visible = false; // btnDelete.Visible = false; btnRestore.Visible = true; checkEmployeeDeleted = true; btnPermanentDelete.Visible = false; delete = 1;// chon tim kiem theo danh sach nhan vien nghi //btnPermanentDelete.Visible = true; EmployeeDO employeeDO = new EmployeeDO(); dsEmployee = employeeDO.GetDeletedEmployeeInsurance((int)departmentTreeView.SelectedNode.Tag); PopulateEmployeeListView(); } else if (delete == 1) { checkEmployeeDeleted = false; delete = 0; departmentTreeView.DepartmentDataSet = departmentDO.GetAllDepartments(); departmentTreeView.BuildTree(); departmentTreeView.SelectedNode = departmentTreeView.TopNode; EmployeeDO employeeDO = new EmployeeDO(); dsEmployee = employeeDO.GetEmployeeByDepartmentInsurance((int)departmentTreeView.SelectedNode.Tag); Refresh(); btnRestore.Visible = false; btnPermanentDelete.Visible = true; } }
private void frmSearch_Load(object sender, EventArgs e) { Refresh(); employeeDO = new EmployeeDO(); PopulateEmployeeListView(); ShowCurrentTime(); }
/// <summary> /// Hiển thị thông tin chi tiết nhân viên trong ảnh /// </summary> private void ShowEmployeeDetail() { UI.Employee.frmEmployee frmemployee = new frmEmployee(); employeeDO = new EmployeeDO(); dsEmployee = employeeDO.GetEmployeeProfile(EmployeeID); frmemployee.EmployeeDataSet = dsEmployee; frmemployee.SelectedEmployee = selectedEmployee; frmemployee.ShowDialog(); }
private void frmListEmployees_Load(object sender, EventArgs e) { departmentDO = new DepartmentDO(); employeeDO = new EmployeeDO(); departmentTreeView.DepartmentDataSet = departmentDO.GetAllDepartments(); departmentTreeView.BuildTree(); departmentTreeView.SelectedNode = departmentTreeView.TopNode; Refresh(); }
private void frmChangeTimeInOut_Load(object sender, System.EventArgs e) { Refresh(); timeInOutDO = new TimeInOutDO(); employeeDO = new EmployeeDO(); DepartmentDO departmentDO = new DepartmentDO(); departmentTreeView.DepartmentDataSet = departmentDO.GetAllDepartments(); departmentTreeView.BuildTree(); departmentTreeView.SelectedNode = departmentTreeView.TopNode; }
private void frmRegWorkingTime_Load(object sender, EventArgs e) { Refresh(); cboDinnnerAmount.Enabled = false; employeeDO = new EmployeeDO(); DepartmentDO departnemtDO = new DepartmentDO(); departmentTreeView.DepartmentDataSet = departnemtDO.GetAllDepartments(); departmentTreeView.BuildTree(); departmentTreeView.ExpandNodes(true); departmentTreeView.SelectedNode = departmentTreeView.TopNode; regOverTimeDO = new RegOverTimeDO(); dtRegOverTime = dsRegOverTime.Tables[0]; monthCalendar1.SelectDate(DateTime.Today); //CurrentYear = DateTime.Today.Year; CurrentYear = DateTime.Now.Year; monthCalendar1.ActiveMonth.Year = CurrentYear; CurrentMonth = DateTime.Today.Month; monthCalendar1.ActiveMonth.Month = CurrentMonth; monthCalendar1.SelectDate(DateTime.Today); if (selectedRegOverTime >= 0) { // disable các thuộc tính liên quan đến nhân viên string str = WorkingContext.LangManager.GetString("frmRegOverTime1_Text2"); //this.Text = "Sửa đăng ký làm thêm giờ"; this.Text = str; LoadRegOverTime(); // optEmployee.Checked = true; departmentTreeView.Enabled = false; // optAll.Enabled = false; //dtpDayWorking.Enabled = false; //cboEmployeeName.Enabled = false; lvwListEmployee.Enabled = false; } else { string str = WorkingContext.LangManager.GetString("frmRegOverTime1_Text1"); //this.Text = "Thêm đăng ký làm thêm giờ"; this.Text = str; //txtEmployeeName.Enabled = false; //cboEmployeeName.Enabled = false; } PopulateShiftCombo(); }
public FrmUpdateDepartmentHistory(int iEmployeeID, string strDepartmentName, DateTime dtModify, string strDecNumber, string strNote, int iSelectedRow) { InitializeComponent(); employeeDO = new EmployeeDO(); dsDepartmentHistory = employeeDO.GetDepartmentHistory(iEmployeeID); rowUpdate = dsDepartmentHistory.Tables[0].Rows[iSelectedRow]; txtBoPhan.Text = strDepartmentName; txtDecNumber.Text = strDecNumber; dptDate.Value = dtModify; txtNote.Text = strNote; //Lưu lại các thông tin trước khi update DecNumberBeforeUpdate = strDecNumber; ModifiedDateBeforeUpdate = dtModify.Date; NoteBeforeUpdate = strNote; }
public FrmUpdateSalaryHistory(int iEmployeeID, decimal dbSalary, string strDecNumber, DateTime dtModefiedDate, string strNote, int iSelectedRow) { InitializeComponent(); employeeDO = new EmployeeDO(); dsSalaryHistory = employeeDO.GetSalaryHistory(iEmployeeID); rowUpdate = dsSalaryHistory.Tables[0].Rows[iSelectedRow]; txtSalary.Text = dbSalary.ToString(); txtDecNumber.Text = strDecNumber; dtpDate.Value = dtModefiedDate; txtNote.Text = strNote; //Lưu lại các thông tin trước khi update SalaryBeforeUpdate = dbSalary; DecNumberBeforeUpdate = strDecNumber; ModifiedDateBeforeUpdate = dtModefiedDate.Date; NoteBeforeUpdate = strNote; }
public ActionResult Login(LoginPO form) { ActionResult response; if (ModelState.IsValid) { EmployeeDO userData = _EmployeeDAO.ViewEmployeeByUsername(form.Username); if (!userData.EmployeeId.Equals(0)) { if (form.Password.Equals(userData.Password)) { Session["EmployeeId"] = userData.EmployeeId; Session["Username"] = userData.Username; Session["Title"] = userData.Title; Session["Role"] = userData.Role; response = RedirectToAction("Index", "Home"); } else { ModelState.AddModelError("Password", "Username or password was incorrect"); response = View(form); } } else { ModelState.AddModelError("Password", "Username or password was incorrect"); response = View(form); } } else { response = View(form); } return(response); }
private void AddEmployeeHistory() { // Thay đổi diễn biến lương EmployeeDO employeeDO = new EmployeeDO(); int ret = 0; try { dsEmployee = employeeDO.GetAllEmployees(1); foreach (DataRow row in dsEmployee.Tables[0].Rows) { int EmployeeID = Convert.ToInt32(row["EmployeeID"].ToString()); dsSalaryHistory = employeeDO.GetSalaryHistory(EmployeeID); DataRow dr = dsSalaryHistory.Tables[0].NewRow(); dr.BeginEdit(); dr["EmployeeID"] = EmployeeID; dr["BasicSalary"] = Convert.ToDouble(row["BasicSalary"].ToString()); dr["DecisionNumber"] = "001"; dr["Note"] = "Thay Đổi lương công ty !"; dr["ModifiedDate"] = DateTime.Now; dr.EndEdit(); dsSalaryHistory.Tables[0].Rows.Add(dr); ret = employeeDO.AddSalaryHistory(dsSalaryHistory); } } catch { } if (ret == 0) { string str = WorkingContext.LangManager.GetString("frmEmployee_UpdateE_Error_Messa3"); string str1 = WorkingContext.LangManager.GetString("frmEmployee_UpdateE_Error_Title1"); //MessageBox.Show("Không thể thêm thay đổi vào diễn biến lương của nhân viên.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show(str, str1, MessageBoxButtons.OK, MessageBoxIcon.Error); dsSalaryHistory.RejectChanges(); } else { dsSalaryHistory.AcceptChanges(); } }
private void FrmUser_Load(object sender, EventArgs e) { employeeDO = new EmployeeDO(); adminDO = new AdminDO(); PopulateUserAndGroupCombos(); if (selectedUser >= 0) { string str = WorkingContext.LangManager.GetString("frmUser_Text1"); this.Text = str; // Hien thi thong tin nguoi dung LoadCurrentUser(); } else { string str = WorkingContext.LangManager.GetString("frmUser_Text2"); this.Text = str; this.txtUsername.TabIndex = 0; } Refresh(); }
//View by id public EmployeeDO ViewById(int id) { EmployeeDO response = new EmployeeDO(); try { using (SqlConnection sqlConnection = new SqlConnection(_ConnectionString)) using (SqlCommand viewSupplierByID = new SqlCommand("VIEW_EMPLOYEE_BY_ID", sqlConnection)) { viewSupplierByID.CommandType = CommandType.StoredProcedure; viewSupplierByID.CommandTimeout = 90; viewSupplierByID.Parameters.AddWithValue("@Id", id); sqlConnection.Open(); using (SqlDataReader reader = viewSupplierByID.ExecuteReader()) { if (reader.Read()) { response = Mapper.ReaderToEmployee(reader); } } sqlConnection.Close(); } } catch (SqlException sqlEx) { Logger.ErrorLogPath = _LogPath; Logger.SqlExceptionLog(sqlEx); throw sqlEx; } return(response); }
//View all public List <EmployeeDO> ViewAll() { List <EmployeeDO> allEmployees = new List <EmployeeDO>(); try { using (SqlConnection sqlConnection = new SqlConnection(_ConnectionString)) using (SqlCommand viewSupplierByID = new SqlCommand("VIEW_ALL_EMPLOYEES", sqlConnection)) { viewSupplierByID.CommandType = CommandType.StoredProcedure; viewSupplierByID.CommandTimeout = 90; sqlConnection.Open(); using (SqlDataReader reader = viewSupplierByID.ExecuteReader()) { while (reader.Read()) { EmployeeDO item = new EmployeeDO(); item = Mapper.ReaderToEmployee(reader); allEmployees.Add(item); } } sqlConnection.Close(); } } catch (SqlException sqlEx) { Logger.ErrorLogPath = _LogPath; Logger.SqlExceptionLog(sqlEx); throw sqlEx; } return(allEmployees); }
public static EmployeeDO ReaderToEmployee(SqlDataReader from) { EmployeeDO to = new EmployeeDO(); to.EmployeeId = (int)from["EmployeeId"]; to.LastName = from["LastName"] as string; to.FirstName = from["FirstName"] as string; to.Title = from["Title"] as string; to.TitleOfCourtesy = from["TitleOfCourtesy"] as string; if (!(from["BirthDate"] is DBNull)) { to.BirthDate = (DateTime)from["BirthDate"]; } if (!(from["HireDate"] is DBNull)) { to.HireDate = (DateTime)from["HireDate"]; } to.Address = from["Address"] as string; to.City = from["City"] as string; to.Region = from["Region"] as string; to.PostalCode = from["PostalCode"] as string; to.Country = from["Country"] as string; to.HomePhone = from["HomePhone"] as string; to.Extension = from["Extension"] as string; //Removed photo to.Notes = from["Notes"] as string; to.ReportsTo = (int?)from["ReportsTo"]; to.PhotoPath = from["PhotoPath"] as string; to.Username = from["Username"] as string; to.Password = from["Password"] as string; to.Role = (int)from["Role"]; return(to); }
private void btnSave_Click(object sender, System.EventArgs e) { int check = CheckData(); if (check == 0) { string value = ""; if (cbValue.Visible) { value = cbValue.Text; } else if (textBox2.Visible) { value = textBox2.Text; } else if (dtpTime.Visible) { value = "1900-01-01 " + dtpTime.Value.Hour + ":" + dtpTime.Value.Minute + ":00"; } if (string.Compare(SysVarname, "UpdateBasicSalary") == 0) { try { double BasicSalary = Convert.ToDouble(value); EmployeeDO employeeDO = new EmployeeDO(); int result = employeeDO.UpdateBasicSalary(BasicSalary); if (result == 1) { AddEmployeeHistory(); MessageBox.Show("Cập nhật lương CB thành công !"); } else { MessageBox.Show("Lỗi hệ thống !"); } this.Close(); } catch { MessageBox.Show("Giá trị kiểu số !"); } } else if (string.Compare(SysVarname, "UpdateLunchCompany") == 0) { try { EmployeeDO employeeDO = new EmployeeDO(); int result = employeeDO.UpdateLunchCompany(Convert.ToDouble(value)); if (result == 1) { DOadmin.UpdateSysVar(SysVarname, textBox1.Text, value, true); frm.GetSysVar(); MessageBox.Show("Cập nhật PC ăn trưa thành công !"); this.Close(); } else { MessageBox.Show("Lỗi hệ thống !"); } this.Close(); } catch { MessageBox.Show("Giá trị kiểu số !"); } } else { DOadmin.UpdateSysVar(SysVarname, textBox1.Text, value, true); frm.GetSysVar(); this.Close(); } } else if (check == 1) { MessageBox.Show("Vui lòng nhập vào mô tả", "Thông báo"); textBox1.Focus(); } else { MessageBox.Show("Vui lòng nhập vào gía trị", "Thông báo"); textBox2.Focus(); } }