private void dgvMaintenanceEmployees_DoubleClick(object sender, EventArgs e) { if (this.dgvMaintenanceEmployees.CurrentRow.Index != -1) { this.employeePlan.IdEmployeePlan = Convert.ToInt32(this.dgvMaintenanceEmployees.CurrentRow.Cells["IdEmployeePlan"].Value); this.employeePlan = this.db.EmployeePlans.Where(x => x.IdEmployeePlan == this.employeePlan.IdEmployeePlan).First(); this.dtpEmployeeStartDate.Value = new DateTime( employeePlan.StartDate.Year, employeePlan.StartDate.Month, employeePlan.StartDate.Day, 0, 0, 0); this.tpEmployeeStartDate.Value = new DateTime( employeePlan.StartDate.Year, employeePlan.StartDate.Month, employeePlan.StartDate.Day, employeePlan.StartDate.Hour, employeePlan.StartDate.Minute, employeePlan.StartDate.Second); this.dtpEmployeeEndDate.Value = new DateTime( employeePlan.EndDate.Year, employeePlan.EndDate.Month, employeePlan.EndDate.Day, 0, 0, 0); this.tpEmployeeEndDate.Value = new DateTime( employeePlan.EndDate.Year, employeePlan.EndDate.Month, employeePlan.EndDate.Day, employeePlan.EndDate.Hour, employeePlan.EndDate.Minute, employeePlan.EndDate.Second); this.btnDeleteEmployee.Enabled = true; } }
void clearEmployee() { this.dtpEmployeeStartDate.Value = this.dtpEmployeeEndDate.Value = DateTime.Now; this.tpEmployeeStartDate.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 8, 0, 0); this.tpEmployeeEndDate.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 16, 0, 0); this.employeePlan = new EmployeePlan(); this.idSelectedEmployee = 0; }