// GET: Employees/Delete/5 public async Task <IActionResult> Delete(string id) { if (id == null) { return(NotFound()); } var employee = await _context.Employees .Include(e => e.Approver) .Include(e => e.Supervisor) .FirstOrDefaultAsync(m => m.Id == id); if (employee == null) { return(NotFound()); } var employeePay = await _context.EmployeePays.Where(ep => ep.EmployeeId == id).Where(ep => ep.Status == EmployeePay.VALID).Include(ep => ep.PayGrade).FirstOrDefaultAsync(); var employeeManagement = new EmployeeManagement { Employee = employee, EmployeePay = employeePay }; return(View(employeeManagement)); }
//-----------------Metodo de ACME------------------------------- private void SaveButton_Click(object sender, EventArgs e) { try { if (!string.IsNullOrEmpty(NameTextBox.Text) && !string.IsNullOrEmpty(LastNameTextBox.Text)) { DateTime bornDate = BornDateTimePicker.Value; DateTime fecha = DateTime.Now; if (EmployeeManagement.InsertEmployee(NameTextBox.Text, LastNameTextBox.Text, PhoneNumberTextBox.Text, IdTypeComboBox.SelectedItem.ToString(), IdentificationTextBox.Text, bornDate, fecha)) { FrmMain.Instance.ToolStripLabel.Text = "Se agrego el Empleado correctamente."; Clear(); ReloadEmployees(); } else { FrmMain.Instance.ToolStripLabel.Text = "Error! No se pudo agregar el Empleado."; } } else { FrmMain.Instance.ToolStripLabel.Text = "Error! El nombre y apellido son campos obligarios."; } } catch (Exception) { MetroMessageBox.Show(this, $"Ha ocurrido un error al agregar el empleado.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
//--------------------Metodos de actualizaciones------------------------- private void ReloadEmployees() { employeeModels = EmployeeManagement.SelectAllEmployees(); EmployeeDataGridView.MultiSelect = false; EmployeeDataGridView.DataSource = employeeModels; EmployeeDataGridView.Columns["Id_Employee"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; EmployeeDataGridView.Columns["Name"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; EmployeeDataGridView.Columns["LastName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; EmployeeDataGridView.Columns["Telephone"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; EmployeeDataGridView.Columns["Identification_Type"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; EmployeeDataGridView.Columns["Identification"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; EmployeeDataGridView.Columns["Born_Date"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; EmployeeDataGridView.Columns["Registration_Date"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; EmployeeDataGridView.Columns["Id_Employee"].HeaderText = "Id"; EmployeeDataGridView.Columns["Name"].HeaderText = "Nombre"; EmployeeDataGridView.Columns["LastName"].HeaderText = "Apellidos"; EmployeeDataGridView.Columns["Telephone"].HeaderText = "Teléfono"; EmployeeDataGridView.Columns["Identification_Type"].HeaderText = "Tipo de Identificación"; EmployeeDataGridView.Columns["Identification"].HeaderText = "Identificación"; EmployeeDataGridView.Columns["Born_Date"].HeaderText = "Fecha de Nacimiento"; EmployeeDataGridView.Columns["Registration_Date"].HeaderText = "Fecha de Registro"; EmployeeDataGridView.Columns["Id_Employee"].Visible = false; EmployeeDataGridView.Columns["Born_Date"].DefaultCellStyle.Format = "d"; EmployeeDataGridView.Columns["Registration_Date"].DefaultCellStyle.Format = "d"; EmployeeDataGridView.Columns["Born_Date"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; EmployeeDataGridView.Columns["Registration_Date"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; EmployeeDataGridView.Columns["Identification"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; }
private void btnDangNhap_Click(object sender, EventArgs e) { //aa DBConnect cn = new DBConnect(); string txtID = txtId.Text; string txtPass = txtPASS.Text; EmployeeManagement employee = new EmployeeManagement(); cn.conn.Open(); if (employee.CheckLogin(txtID, txtPass) == 3) { frmNhanVien NV = new frmNhanVien(); NV.Show(); } else if (employee.CheckLogin(txtID, txtPass) == 0) { MessageBox.Show("Dữ liệu không hợp lệ"); } else { frmQuanLi QL = new frmQuanLi(); QL.Show(); } cn.conn.Close(); }
private void btnLoad_Click(object sender, EventArgs e) { //Hoten,SDT,DiaChi,GioiTinh EmployeeManagement employee = new EmployeeManagement(); DataTable tb = employee.LoaddataNV(EmployeeManagement.UserID); //btnNhacNho.Text = EmployeeManagement.UserID; }
public ActionResult Emp() { //var employees = objISession.Query<Employee>().ToList(); //List<Employee> employees = EmployeeManagement.GetAllEmployees(objISession); List <Employee> employees = EmployeeManagement.GetResultFromSP(objISession); return(View(employees)); }
public void GetEmployees_TestWithValidContractType() { var employeeRepositoryMock = new Mock <IEmployeeRepository>(); var employeeFactory = new EmployeeFactory(); var hourlysalaryCalculatorMock = new Mock <ISalaryCalculator>(); var monthlysalaryCalculatorMock = new Mock <ISalaryCalculator>(); Func <string, ISalaryCalculator> salaryCalculatorFactory = delegate(string name) { if (name == EmployeeTypeContract.Hourly) { return(hourlysalaryCalculatorMock.Object); } else if (name == EmployeeTypeContract.Monthy) { return(monthlysalaryCalculatorMock.Object); } return(null); }; EmployeeManagement employeeManagementTest = new EmployeeManagement(employeeRepositoryMock.Object, employeeFactory, salaryCalculatorFactory, mapper); List <HandsOnTest.DbModels.Employee> dbEmployees = new List <DbModels.Employee>(); dbEmployees.Add(new DbModels.Employee() { Id = 1, Name = "Emp1", ContractTypeName = EmployeeTypeContract.Hourly, HourlySalary = 200.00 }); dbEmployees.Add(new DbModels.Employee() { Id = 2, Name = "Emp2", ContractTypeName = EmployeeTypeContract.Monthy, MonthlySalary = 2000.00 }); employeeRepositoryMock.Setup(t => t.GetAll()).Returns(dbEmployees); hourlysalaryCalculatorMock.Setup(t => t.GetAnnualSalary(It.IsAny <double?>())).Returns(400); monthlysalaryCalculatorMock.Setup(t => t.GetAnnualSalary(It.IsAny <double?>())).Returns(100); var employees = employeeManagementTest.GetEmployees(1); Assert.AreEqual(1, employees.Count); Assert.AreEqual(400, employees[0].AnnualSalary); employees = employeeManagementTest.GetEmployees(2); Assert.AreEqual(1, employees.Count); Assert.AreEqual(100, employees[0].AnnualSalary); employees = employeeManagementTest.GetEmployees(null); Assert.AreEqual(2, employees.Count); Assert.AreEqual(400, employees[0].AnnualSalary); Assert.AreEqual(100, employees[1].AnnualSalary); //employeeManagementTest.GetEmployees() }
private void BtnManagement_Click(object sender, EventArgs e) { LoadStore = LoadEmployeeManage = false; toggle(sender, panelEmployee.Top); panel4.Controls.Clear(); EmployeeManagement user_employee = new EmployeeManagement(); panel4.Controls.Add(user_employee); }
private void UcInputInvoice_Load(object sender, EventArgs e) { EmployeeComboBox.DataSource = EmployeeManagement.SelectAllEmployees(); EmployeeComboBox.DisplayMember = "Name"; DestinyComboBox.DataSource = BusinessManagement.SelectAllBusiness(); DestinyComboBox.DisplayMember = "fantasyName"; ProviderComboBox.DataSource = BusinessManagement.SelectAllBusiness(); ProviderComboBox.DisplayMember = "fantasyName"; WrapProductsGridView(); }
public ActionResult About() { ViewBag.Message = "Your application description page."; List <Employee> employees = EmployeeManagement.GetAllEmployees(objISession); var emp = from t in employees where t.EmployeeId == 1 select t; return(View(emp.FirstOrDefault())); }
private void UcAparts_Load(object sender, EventArgs e) { employeeComboBox.DataSource = EmployeeManagement.SelectAllEmployees(); employeeComboBox.DisplayMember = "Name"; StoreComboBox.DataSource = BusinessManagement.SelectAllBusiness(); StoreComboBox.DisplayMember = "fantasyName"; clientComboBox.DataSource = ClientManagement.SelectAllClients(); clientComboBox.DisplayMember = "Name"; WrapProductsGridView(); }
public bool EmployeePerformance(EmployeeManagement Information) { if (Information != null) { db.EmployeeManagements.Add(Information); db.SaveChanges(); return(true); } else { return(false); } }
private void CleanButton_Click(object sender, EventArgs e) { try { Clear(); employeeModels = EmployeeManagement.SelectAllEmployees(); EmployeeDataGridView.DataSource = employeeModels; } catch (Exception) { MetroMessageBox.Show(this, $"Ha ocurrido un error al limpiar la ventana.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnXacNhan_Click(object sender, EventArgs e) { EmployeeManagement ep = new EmployeeManagement(); if (ep.ChangePass(Int32.Parse(txtMa.Text), txtMKcu.Text, txtMKmoi.Text)) { MessageBox.Show("Đổi mật khẩu thành công", "Thông báo"); } else { MessageBox.Show("Đổi mật khẩu thất bại", "Thông báo"); } }
private void btnUpdateEmployee_Click(object sender, EventArgs e) { string id = dgvEmployee.CurrentRow.Cells[0].Value.ToString(); string name = txtNameEmployee.Text; string lastname = txtLastnameEmployee.Text; string telephone = mtxtTelephone.Text; string cellphone = mtxtCellphone.Text; string idType = cmbIdentificationType.Text; string identif = txtIdentification.Text; string bornDate = datepBornDate.Text; string email = txtEmailEmployee.Text; string nationality = txtNacionality.Text; string residence = txtResidence.Text; string civilStatus = cmbCivilState.Text; string childs = cmbChilds.Text; string enterStore = cmbEnterStore.Text; PositionModel position = (PositionModel)cmbPosition.SelectedItem; string statusWorking = workingStateComboBox.Text; string startDate = startDateDateTime.Text; string endDate = startDateDateTime.Text; string observation = txaObservation.Text; string emergencyName = txtEmergencyName.Text; string emergencyPhone = mtxtEmergencyPhone.Text; if (!string.IsNullOrEmpty(file)) { photo = ImageManagement.ImageToByte(file); } try { if (EmployeeManagement.UpdateEmployeeById(id, name, lastname, idType, identif, residence, bornDate, civilStatus, childs, telephone, cellphone, enterStore, nationality, position.idPosition.ToString(), statusWorking, startDate, endDate, observation, photo, emergencyName, emergencyPhone)) { dgvEmployee.DataSource = EmployeeManagement.SelectAllEmployees(); FrmMain.Instance.ToolStripLabel.Text = "Se modifico el trabajador correctamente"; } else { FrmMain.Instance.ToolStripLabel.Text = "No se pudo modificar el trabajador"; } } catch (Exception) { throw; } }
//---------Metodo de busqueda----------------------- private void SearchTextBox_ButtonClick(object sender, EventArgs e) { if (!string.IsNullOrEmpty(SearchTextBox.Text)) { EmployeeDataGridView.DataSource = EmployeeManagement.SelectMultipleEmployees(SearchTextBox.Text); FrmMain.Instance.ToolStripLabel.Text = "Lista de Empleados cargada correctamente."; Clear(); } else { FrmMain.Instance.ToolStripLabel.Text = "Error! El campo buscar no puede ser vacio."; } }
public ActionResult AddEmployee(EmployeeAdd Item) { var add = new EmployeeManagement(); add = Item.employeeManagement; add.Position = Request.Form["position"]; _context.EmployeeManagements.Add(add); _context.SaveChanges(); return(Redirect("Index")); }
// 직원 등록 private void btn_Confirm_Click(object sender, EventArgs e) { if (checkTextBox() && CheckPK()) { string employee_name = this.txtName.Text; string employee_phone = this.txtMobile.Text.Trim().Replace(" ", ""); string employee_position = this.txtPosition.Text; string employee_address = this.txtAddr.Text; string employee_salary = this.txtSalary.Text; string employee_hours = this.txtHours.Text; string employee_total_salary = this.txtTSalary.Text; string employee_pk = this.txtBirth.Text; using (var con = new SqlConnection(ConfigurationManager.ConnectionStrings["ConvenienceStore"].ConnectionString)) { using (var cmd = new SqlCommand("EmployeeAdd", con)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@employee_name", employee_name); cmd.Parameters.AddWithValue("@employee_phone", employee_phone); cmd.Parameters.AddWithValue("@employee_position", employee_position); cmd.Parameters.AddWithValue("@employee_address", employee_address); cmd.Parameters.AddWithValue("@employee_salary", employee_salary); cmd.Parameters.AddWithValue("@employee_hours", employee_hours); cmd.Parameters.AddWithValue("@employee_total_salary", employee_total_salary); cmd.Parameters.AddWithValue("@employee_pk", employee_pk); con.Open(); componentInit(); int i = cmd.ExecuteNonQuery(); if (i == 1) { MessageBox.Show("등록 되었습니다."); EmployeeManagement emg = (EmployeeManagement)Owner; emg.ResetGridView(); return; } else { MessageBox.Show("등록 실패"); return; } } } } }
public string FetchAllEmployees() { return(JSON.Serializer <List <Employee> >( Connection.Sql <List <Employee> >($"SELECT * FROM {Table.EMPLOYEE}", func) )); List <Employee> func(NpgsqlDataReader reader) { List <Employee> employeesList = new List <Employee>(); while (reader.Read()) { employeesList.Add( EmployeeManagement.UpdateReaderDataToEmployee(reader) ); } return(employeesList); } }
private void txtSearchEmployee_KeyPress(object sender, KeyPressEventArgs e) { string text = txtSearchEmployee.Text; try { if (text != "") { dgvEmployee.DataSource = EmployeeManagement.SelecEmployeeByNameOrLastName(text); } else { dgvEmployee.DataSource = EmployeeManagement.SelectAllEmployees(); } } catch (Exception) { throw; } }
private void btnDeleteEmployee_Click(object sender, EventArgs e) { string idEmployee = dgvEmployee.CurrentRow.Cells[0].Value.ToString(); try { if (EmployeeManagement.DeleteEmployeeById(idEmployee)) { dgvEmployee.DataSource = EmployeeManagement.SelectAllEmployees(); FrmMain.Instance.ToolStripLabel.Text = "Se elimino el trabajador"; } else { FrmMain.Instance.ToolStripLabel.Text = "Error al eliminar el trabajador"; } } catch (Exception) { throw; } }
public IHttpActionResult GetEmpList() { JSONTemplateListModel <Employees> response = new JSONTemplateListModel <Employees>() { Data = null, Status = API_Enum.API_STATUS_RESULT.FAIL }; try { EmployeeManagement Emp = new EmployeeManagement(); response.Data = Emp.GetEmployeesList(); response.Status = API_Enum.API_STATUS_RESULT.SUCCESS; return(JsonResp(response)); } catch (Exception ex) { response.Message = "Error, Please try again later."; return(JsonResp(response)); } }
private void btnXacNhan_Click(object sender, EventArgs e) { string[] getTT = new string[4]; getTT[0] = txtHoTen.Text; getTT[1] = txtDiaChi.Text; getTT[2] = txtSDT.Text; getTT[3] = comboGT.Text; int check = 1; if (Regex.Matches(getTT[2], @"[a-zA-Z]").Count == 1) { MessageBox.Show("Số điện thoại không có chữ cái"); check = 0; } if (Regex.Matches(getTT[0], @"[0-9]+").Count == 1) { MessageBox.Show("Tên không có kí tự số"); check = 0; } for (int i = 0; i < 4; i++) { if (getTT[i].Equals("") == true) { MessageBox.Show("Không được để trống"); check = 0; break; } if (check == 1) { EmployeeManagement employ = new EmployeeManagement(); employ.UpdatedataNV(EmployeeManagement.UserID, getTT[0], getTT[1], getTT[2], getTT[3]); MessageBox.Show("Cập nhật thành công"); break; } //UpdatedataNV } }
private void DeleteButton_Click(object sender, EventArgs e) { if (!IdLabel.Text.Equals("none")) { if (!string.IsNullOrEmpty(NameTextBox.Text) && !string.IsNullOrEmpty(LastNameTextBox.Text) && EmployeeDataGridView.CurrentRow.Cells[0].Value.ToString() != null) { int Id = int.Parse(IdLabel.Text); if (EmployeeManagement.DeleteEmployeeById(Id)) { FrmMain.Instance.ToolStripLabel.Text = "Se elimino el Empleado correctamente."; Clear(); ReloadEmployees(); } else { FrmMain.Instance.ToolStripLabel.Text = "Error! No se pudo eliminar el Empleado."; } } else { } } }
private void UpdateButton_Click(object sender, EventArgs e) { if (!IdLabel.Text.Equals("none")) { if (!string.IsNullOrEmpty(NameTextBox.Text) && !string.IsNullOrEmpty(LastNameTextBox.Text) && EmployeeDataGridView.CurrentRow.Cells[0].Value.ToString() != null) { if (MetroMessageBox.Show(this, $"¿Seguro que desea modificar al empleado: { EmployeeDataGridView.CurrentRow.Cells[1].Value.ToString() }?", "Modificar empleado", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { if (EmployeeManagement.UpdateEmployeeById(int.Parse(IdLabel.Text), NameTextBox.Text, LastNameTextBox.Text, PhoneNumberTextBox.Text, IdTypeComboBox.SelectedItem.ToString(), IdentificationTextBox.Text, BornDateTimePicker.Value)) { FrmMain.Instance.ToolStripLabel.Text = "Se modifico el Empleado correctamente."; Clear(); ReloadEmployees(); } else { MetroMessageBox.Show(this, $"Ha ocurrido un error al modificar al empleado: { NameTextBox.Text}.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } } }
// GET: Employees/Edit/5 public async Task <IActionResult> Edit(string id) { if (id == null) { return(NotFound()); } var employee = await _context.Employees.FindAsync(id); if (employee == null) { return(NotFound()); } var employees = await _context.Employees.ToListAsync(); var jobTitles = Employee.JobTitles.ToList(); var statuses = Employee.Statuses.ToList(); var payLevels = await _context.PayGrades.Where(pg => pg.Year == DateTime.Now.Year).OrderBy(pg => pg.PayLevel).ToListAsync(); var employeePay = await _context.EmployeePays.Where(ep => ep.EmployeeId == id).Where(ep => ep.Status == EmployeePay.VALID).FirstOrDefaultAsync(); ViewData["ApproverId"] = new SelectList(employees, "Id", "Email", employee.ApproverId); ViewData["SupervisorId"] = new SelectList(employees, "Id", "Email", employee.SupervisorId); ViewData["Title"] = new SelectList(jobTitles, "Key", "Value", employee.Title); ViewData["Status"] = new SelectList(statuses, "Key", "Value", employee.Status); ViewData["PayLevel"] = new SelectList(payLevels, "PayGradeId", "PayLevel", employeePay.PayGradeId); var employeeManagement = new EmployeeManagement { Employee = employee, EmployeePay = employeePay, }; return(View(employeeManagement)); }
public async Task <string> Add() { Role requestBody = await JSON.httpContextDeseriliser <Role>(Request); if (EmployeeManagement.IsRoleExist(requestBody.role)) { Response.StatusCode = StatusCodes.Status304NotModified; return("Role has already been Added"); } int roleCount = Connection.Sql <int>( $"INSERT INTO {Table.ROLES} (role) VALUES ('{requestBody.role}')", (reader) => reader.RecordsAffected ); if (roleCount > 0) { Response.StatusCode = StatusCodes.Status201Created; return($"{requestBody.role} Role Successfully Added"); } Response.StatusCode = StatusCodes.Status502BadGateway; return("Internal Error"); }
// 직원 수정 private void btn_Confirm_Click(object sender, EventArgs e) { using (var con = new SqlConnection(ConfigurationManager.ConnectionStrings["ConvenienceStore"].ConnectionString)) { using (var cmd = new SqlCommand("EmployeeModiAdd", con)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@employee_name", this.txtName.Text); cmd.Parameters.AddWithValue("@employee_phone", this.txtMobile.Text); cmd.Parameters.AddWithValue("@employee_position", this.txtPosition.Text); cmd.Parameters.AddWithValue("@employee_address", this.txtAddr.Text); cmd.Parameters.AddWithValue("@employee_salary", this.txtSalary.Text); cmd.Parameters.AddWithValue("@employee_hours", this.txtHours.Text); cmd.Parameters.AddWithValue("@employee_total_salary", this.txtTSalary.Text); cmd.Parameters.AddWithValue("@employee_pk", this.txtBirth.Text); con.Open(); componentInit(); int i = cmd.ExecuteNonQuery(); if (i == 1) { MessageBox.Show("수정 되었습니다."); EmployeeManagement emg = (EmployeeManagement)Owner; emg.ResetGridView(); return; } else { MessageBox.Show("수정하실 직원을 검색해주세요."); return; } } } }
public async Task <string> Signup() => await EmployeeManagement.Add(Request);
public EmployeeController(EmployeeManagement employee) { _employee = employee; }