private void LoadData(int toDoId) { ToDoListInformationBasicInformationGateway toDoListInformationBasicInformationGateway = new ToDoListInformationBasicInformationGateway(toDoListInformationTDS); if (toDoListInformationBasicInformationGateway.Table.Rows.Count > 0) { // Load to do Details int companyId = Int32.Parse(hdfCompanyId.Value); int createdById = toDoListInformationBasicInformationGateway.GetCreatedByID(toDoId); hdfCreatedById.Value = createdById.ToString(); EmployeeGateway employeeGateway = new EmployeeGateway(); employeeGateway.LoadByEmployeeId(createdById); tbxCreatedBy.Text = employeeGateway.GetFullName(createdById); tbxCreationDate.Text = toDoListInformationBasicInformationGateway.GetCreationDate(toDoId).ToString(); tbxState.Text = toDoListInformationBasicInformationGateway.GetState(toDoId); if (toDoListInformationBasicInformationGateway.GetDueDate(toDoId).HasValue) { DateTime dueDateValue = (DateTime)toDoListInformationBasicInformationGateway.GetDueDate(toDoId); tbxDueDate.Text = dueDateValue.Month.ToString() + "/" + dueDateValue.Day.ToString() + "/" + dueDateValue.Year.ToString(); } int? unitId = toDoListInformationBasicInformationGateway.GetUnitID(toDoId); tbxUnit.Text = ""; if (unitId.HasValue) { UnitsGateway unitsGateway = new UnitsGateway(); unitsGateway.LoadByUnitId((int)unitId, companyId); tbxUnit.Text = unitsGateway.GetUnitCode((int)unitId) + " " + unitsGateway.GetDescription((int)unitId); } } }
private void Generate() { mReport1 master = (mReport1)this.Master; // Get Data string projectTimeState = (ddlProjectTimeState.SelectedValue == "(All)") ? "%" : ddlProjectTimeState.SelectedValue; PrintVehicleLocationGateway printVehicleLocationGateway = new PrintVehicleLocationGateway(); if (ddlCountry.SelectedValue == "(All)") { if (ddlUnit.SelectedValue == "-1") { printVehicleLocationGateway.LoadByStartDateEndDateProjectTimeState(DateTime.Parse(tkrdpStartDate.SelectedDate.Value.ToShortDateString()), DateTime.Parse(tkrdpEndDate.SelectedDate.Value.ToShortDateString()), projectTimeState); } else { printVehicleLocationGateway.LoadByStartDateEndDateUnitIdProjectTimeState(DateTime.Parse(tkrdpStartDate.SelectedDate.Value.ToShortDateString()), DateTime.Parse(tkrdpEndDate.SelectedDate.Value.ToShortDateString()), int.Parse(ddlUnit.SelectedValue), projectTimeState); } } else { if (ddlUnit.SelectedValue == "-1") { printVehicleLocationGateway.LoadByStartDateEndDateProjectTimeStateCountryId(DateTime.Parse(tkrdpStartDate.SelectedDate.Value.ToShortDateString()), DateTime.Parse(tkrdpEndDate.SelectedDate.Value.ToShortDateString()), projectTimeState, int.Parse(ddlCountry.SelectedValue)); } else { printVehicleLocationGateway.LoadByStartDateEndDateUnitIdProjectTimeStateCountryId(DateTime.Parse(tkrdpStartDate.SelectedDate.Value.ToShortDateString()), DateTime.Parse(tkrdpEndDate.SelectedDate.Value.ToShortDateString()), int.Parse(ddlUnit.SelectedValue), projectTimeState, int.Parse(ddlCountry.SelectedValue)); } } // ... set properties to master page master.Data = printVehicleLocationGateway.Data; master.Table = printVehicleLocationGateway.TableName; // Get report int companyId = Convert.ToInt32(Session["companyID"]); if (printVehicleLocationGateway.Table.Rows.Count > 0) { if (master.Format == "pdf") { master.Report = new LiquiForce.LFSLive.WebUI.LabourHours.ProjectTime.PrintVehicleLocationReport(); } else { master.Report = new LiquiForce.LFSLive.WebUI.LabourHours.ProjectTime.PrintVehicleLocationReportExport(); } // ... set parameters to report if (master.Format == "pdf") { // ... For report // ... ... project time state if (ddlProjectTimeState.SelectedValue == "(All)") { master.SetParameter("projectTimeState", "All"); } else { master.SetParameter("projectTimeState", ddlProjectTimeState.SelectedItem.Text); } // ... ... unit if (ddlUnit.SelectedValue == "-1") { master.SetParameter("unitName", "All"); } else { int unitId = Int32.Parse(ddlUnit.SelectedValue); UnitsGateway unitsGateway = new UnitsGateway(); unitsGateway.LoadByUnitId(unitId, companyId); string unitName = "(" + unitsGateway.GetUnitCode(unitId) + ") " + unitsGateway.GetDescription(unitId); master.SetParameter("unitName", unitName); } // ... ... user int loginId = Convert.ToInt32(Session["loginID"]); LoginGateway loginGateway = new LoginGateway(); loginGateway.LoadByLoginId(loginId, companyId); string user = loginGateway.GetLastName(loginId, companyId) + " " + loginGateway.GetFirstName(loginId, companyId); master.SetParameter("User", user.Trim()); // ... ... dates master.SetParameter("dateFrom", tkrdpStartDate.SelectedDate.Value.ToShortDateString()); master.SetParameter("dateTo", tkrdpEndDate.SelectedDate.Value.ToShortDateString()); // ... ... country if (ddlCountry.SelectedValue == "2") { master.SetParameter("Country", "USA"); } else { if (ddlCountry.SelectedValue == "1") { master.SetParameter("Country", "Canada"); } else { master.SetParameter("Country", "All"); } } } } }