コード例 #1
0
        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));
                }
            }
        }
コード例 #2
0
        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();
        }