protected void ddlYear_SelectedIndexChanged(object sender, EventArgs e) { Session.Remove("employeesVacationsDummy"); int employeeId = Int32.Parse(hdfCurrentEmployeeId.Value); int year = Int32.Parse(ddlYear.SelectedValue); EmployeeInformationPayVacationDaysInformation employeeInformationPayVacationDaysInformation = new EmployeeInformationPayVacationDaysInformation(employeeInformationTDS); employeeInformationPayVacationDaysInformation.LoadByEmployeeIdYear(employeeId, year); EmployeeInformationPayVacationDaysInformationGateway employeeInformationPayVacationDaysInformationGateway = new EmployeeInformationPayVacationDaysInformationGateway(employeeInformationTDS); if (employeeInformationPayVacationDaysInformationGateway.Table.Rows.Count > 0) { tbxMax.Text = employeeInformationPayVacationDaysInformationGateway.GetVacationDays(employeeId, year).ToString(); tbxRemaining.Text = employeeInformationPayVacationDaysInformationGateway.GetRemainingPayVacationDays(employeeId, year).ToString(); tbxTotalApproved.Text = employeeInformationPayVacationDaysInformationGateway.GetTotalApprovedVacations(employeeId, year).ToString(); DateTime startDate = new DateTime(Int32.Parse(ddlYear.SelectedValue), 1, 1); DateTime endDate = new DateTime(Int32.Parse(ddlYear.SelectedValue), 12, 31); EmployeeInformationVacationInformation employeeInformationVacationInformation = new EmployeeInformationVacationInformation(employeeInformationTDS); employeeInformationVacationInformation.LoadByEmployeeIdStartDateEndDate(Int32.Parse(hdfCurrentEmployeeId.Value), startDate, endDate, Int32.Parse(hdfCompanyId.Value)); } grdVacations.DataBind(); }
private void LoadVacationsData(int employeeId) { EmployeeInformationPayVacationDaysInformationList employeeInformationPayVacationDaysInformationList = new EmployeeInformationPayVacationDaysInformationList(); employeeInformationPayVacationDaysInformationList.LoadByEmployeeId(employeeId); if (employeeInformationPayVacationDaysInformationList.Table.Rows.Count > 0) { ddlYear.DataSource = employeeInformationPayVacationDaysInformationList.Table; ddlYear.DataValueField = "Year"; ddlYear.DataTextField = "Year"; ddlYear.DataBind(); if (ddlYear.Items.Contains(new ListItem(DateTime.Now.Year.ToString()))) { ddlYear.SelectedValue = DateTime.Now.Year.ToString(); } else { ddlYear.SelectedIndex = 0; } int year = Int32.Parse(ddlYear.SelectedValue); EmployeeInformationPayVacationDaysInformation employeeInformationPayVacationDaysInformation = new EmployeeInformationPayVacationDaysInformation(employeeInformationTDS); employeeInformationPayVacationDaysInformation.LoadByEmployeeIdYear(employeeId, year); EmployeeInformationPayVacationDaysInformationGateway employeeInformationPayVacationDaysInformationGateway = new EmployeeInformationPayVacationDaysInformationGateway(employeeInformationTDS); if (employeeInformationPayVacationDaysInformationGateway.Table.Rows.Count > 0) { tbxMax.Text = employeeInformationPayVacationDaysInformationGateway.GetVacationDays(employeeId, year).ToString(); tbxRemaining.Text = employeeInformationPayVacationDaysInformationGateway.GetRemainingPayVacationDays(employeeId, year).ToString(); tbxTotalApproved.Text = employeeInformationPayVacationDaysInformationGateway.GetTotalApprovedVacations(employeeId, year).ToString(); DateTime startDate = new DateTime(Int32.Parse(ddlYear.SelectedValue), 1, 1); DateTime endDate = new DateTime(Int32.Parse(ddlYear.SelectedValue), 12, 31); EmployeeInformationVacationInformation employeeInformationVacationInformation = new EmployeeInformationVacationInformation(employeeInformationTDS); employeeInformationVacationInformation.LoadByEmployeeIdStartDateEndDate(employeeId, startDate, endDate, Int32.Parse(hdfCompanyId.Value)); } } }
// //////////////////////////////////////////////////////////////////////// // PUBLIC METHODS // /// <summary> /// LoadByEmployeeIdYear /// </summary> /// <param name="employeeId">employeeId</param> /// <param name="year">year</param> public void LoadByEmployeeIdYear(int employeeId, int year) { EmployeeInformationPayVacationDaysInformationGateway employeeInformationPayVacationDaysInformationGateway = new EmployeeInformationPayVacationDaysInformationGateway(Data); employeeInformationPayVacationDaysInformationGateway.LoadByEmployeeIdYear(employeeId, year); }