// ///////////////////////////////////////////////////////////////////////////////////////////////////// // STEP2 - LOCATION // // //////////////////////////////////////////////////////////////////////// // STEP2 - LOCATION - AUXILIAR EVENTS // protected void ddlCountry_SelectedIndexChanged(object sender, EventArgs e) { OfficeList officeList = new OfficeList(); officeList.LoadByCountryIdAndAddItem(-1, "(Select an office)", int.Parse(ddlCountry.SelectedValue)); ddlOffice.DataSource = officeList.Table; ddlOffice.DataValueField = "OfficeID"; ddlOffice.DataTextField = "Name"; ddlOffice.DataBind(); ddlOffice.SelectedIndex = 0; ProvinceList provinceList = new ProvinceList(); provinceList.LoadByCountryIdAndAddItem(-1, "(Select a province)", int.Parse(ddlCountry.SelectedValue)); ddlProvince.DataSource = provinceList.Table; ddlProvince.DataValueField = "ProvinceID"; ddlProvince.DataTextField = "Name"; ddlProvince.DataBind(); ddlProvince.SelectedIndex = 0; ddlCounty.SelectedIndex = 0; ddlCity.SelectedIndex = 0; }
protected void ddlOwnerCountry_SelectedIndexChanged(object sender, EventArgs e) { ProvinceList provinceList = new ProvinceList(); provinceList.LoadByCountryIdAndAddItem(-1, "(Select a state)", int.Parse(ddlOwnerCountry.SelectedValue)); ddlOwnerState.DataSource = provinceList.Table; ddlOwnerState.DataValueField = "ProvinceID"; ddlOwnerState.DataTextField = "Name"; ddlOwnerState.DataBind(); }
protected void ddlCountryNew_SelectedIndexChanged(object sender, EventArgs e) { DropDownList ddlCountry = ((DropDownList)grdInspections.FooterRow.FindControl("ddlCountryNew")); DropDownList ddlState = ((DropDownList)grdInspections.FooterRow.FindControl("ddlStateNew")); ProvinceList provinceList = new ProvinceList(); provinceList.LoadByCountryIdAndAddItem(-1, "(Select a state)", int.Parse(ddlCountry.SelectedValue)); ddlState.DataSource = provinceList.Table; ddlState.DataValueField = "ProvinceID"; ddlState.DataTextField = "Name"; ddlState.DataBind(); }
private void LoadDetailedData(int unitId) { UnitInformationUnitDetailsGateway unitInformationUnitDetailsGateway = new UnitInformationUnitDetailsGateway(unitInformationTDS); if (unitInformationUnitDetailsGateway.Table.Rows.Count > 0) { // Load for General Tab if (upnlGeneralDataEdit.Visible) { if (unitInformationUnitDetailsGateway.GetAcquisitionDate(unitId).HasValue) { tkrdpAcquisitionDate.SelectedDate = unitInformationUnitDetailsGateway.GetAcquisitionDate(unitId); } if (unitInformationUnitDetailsGateway.GetDispositionDate(unitId).HasValue) { tkrdpDispositionDate.SelectedDate = unitInformationUnitDetailsGateway.GetDispositionDate(unitId); } tbxDispositionReason.Text = unitInformationUnitDetailsGateway.GetDispositionReason(unitId); int companyLevelId = unitInformationUnitDetailsGateway.GetCompanyLevelId(unitId); GetNodeForCategory(tvCategoriesRoot.Nodes, 0); GetNodeForCompanyLevels(tvCompanyLevelsRoot.Nodes, 0, companyLevelId); foreach (TreeNode nodes in tvCategoriesRoot.Nodes) { GetCategoriesParent(nodes); } foreach (TreeNode nodes in tvCompanyLevelsRoot.Nodes) { GetCompanyLevelsParent(nodes); } } else { if (unitInformationUnitDetailsGateway.GetAcquisitionDate(unitId).HasValue) tbxAcquisitionDateSummary.Text = ((DateTime)unitInformationUnitDetailsGateway.GetAcquisitionDate(unitId)).ToShortDateString(); if (unitInformationUnitDetailsGateway.GetDispositionDate(unitId).HasValue) tbxDispositionDateSummary.Text = ((DateTime)unitInformationUnitDetailsGateway.GetDispositionDate(unitId)).ToShortDateString(); tbxDispositionReasonSummary.Text = unitInformationUnitDetailsGateway.GetDispositionReason(unitId); int companyLevelId = unitInformationUnitDetailsGateway.GetCompanyLevelId(unitId); GetNodeForCategory(tvCategoriesRootSummary.Nodes, 0); GetNodeForCompanyLevels(tvCompanyLevelsRootSummary.Nodes, 0, companyLevelId); foreach (TreeNode nodes in tvCategoriesRootSummary.Nodes) { GetCategoriesParent(nodes); } foreach (TreeNode nodes in tvCompanyLevelsRootSummary.Nodes) { GetCompanyLevelsParent(nodes); } } // Load for Plate and Technical Tabs if (unitInformationUnitDetailsGateway.GetType(unitId) == "Vehicle") { if (upnlPlateDataEdit.Visible) { if (unitInformationUnitDetailsGateway.GetLicenseCountry(unitId).HasValue) { Int64 countryId = (Int64)unitInformationUnitDetailsGateway.GetLicenseCountry(unitId); ddlLicenseCountry.SelectedValue = countryId.ToString(); if (unitInformationUnitDetailsGateway.GetLicenseState(unitId).HasValue) { Int64? stateId = null; stateId = unitInformationUnitDetailsGateway.GetLicenseState(unitId); if (stateId.HasValue) { tbxLicenseState.Text = ""; hdfLicenseStateId.Value = ""; if (stateId.ToString() == "12435") { tbxLicenseState.Text = "Ontario"; hdfLicenseStateId.Value = "12435"; } else { if (ddlLicenseCountry.SelectedValue == "2") { tbxLicenseState.Text = "Michigan"; hdfLicenseStateId.Value = "84026"; } } } } } tbxLicensePlateNumber.Text = unitInformationUnitDetailsGateway.GetLicensePlateNumbver(unitId); } else { if (unitInformationUnitDetailsGateway.GetLicenseCountry(unitId).HasValue) { Int64 countryId = (Int64)unitInformationUnitDetailsGateway.GetLicenseCountry(unitId); CountryGateway countryGateway = new CountryGateway(); countryGateway.LoadByCountryId(countryId); tbxLicenseCountrySummary.Text = countryGateway.GetName(countryId); } if (unitInformationUnitDetailsGateway.GetLicenseState(unitId).HasValue) { Int64 stateId = (Int64)unitInformationUnitDetailsGateway.GetLicenseState(unitId); ProvinceGateway provinceGateway = new ProvinceGateway(); provinceGateway.LoadByProvinceId(stateId); tbxLicenseStateSummary.Text = provinceGateway.GetName(stateId); } tbxLicensePlateNumberSummary.Text = unitInformationUnitDetailsGateway.GetLicensePlateNumbver(unitId); } if (upnlTechnicalEdit.Visible) { tbxActualWeight.Text = unitInformationUnitDetailsGateway.GetActualWeight(unitId); tbxRegisteredWeight.Text = unitInformationUnitDetailsGateway.GetRegisteredWeight(unitId); tbxTireSizeFront.Text = unitInformationUnitDetailsGateway.GetTireSizeFront(unitId); tbxTireSizeBack.Text = unitInformationUnitDetailsGateway.GetTireSizeBack(unitId); ddlNumberOfAxes.SelectedValue = unitInformationUnitDetailsGateway.GetNumberOfAxes(unitId); ddlFuelType.SelectedValue = unitInformationUnitDetailsGateway.GetFuelType(unitId); tbxBeginningOdometer.Text = unitInformationUnitDetailsGateway.GetBeginningOdometer(unitId); cbxIsReeferEquipped.Checked = unitInformationUnitDetailsGateway.GetIsReeferEquipped(unitId); cbxIsPtoEquipped.Checked = unitInformationUnitDetailsGateway.GetIsPTOEquipped(unitId); } else { tbxActualWeightSummary.Text = unitInformationUnitDetailsGateway.GetActualWeight(unitId); tbxRegisteredWeightSummary.Text = unitInformationUnitDetailsGateway.GetRegisteredWeight(unitId); tbxTireSizeFrontSummary.Text = unitInformationUnitDetailsGateway.GetTireSizeFront(unitId); tbxTireSizeBackSummary.Text = unitInformationUnitDetailsGateway.GetTireSizeBack(unitId); tbxNumberOfAxesSummary.Text = unitInformationUnitDetailsGateway.GetNumberOfAxes(unitId); tbxFuelTypeSummary.Text = unitInformationUnitDetailsGateway.GetFuelType(unitId); tbxBeginningOdometerSummary.Text = unitInformationUnitDetailsGateway.GetBeginningOdometer(unitId); cbxIsReeferEquippedSummary.Checked = unitInformationUnitDetailsGateway.GetIsReeferEquipped(unitId); cbxIsPtoEquippedSummary.Checked = unitInformationUnitDetailsGateway.GetIsPTOEquipped(unitId); } } // Load for Ownership tab if (upnlOwnershipEdit.Visible) { ddlOwnerType.SelectedValue = unitInformationUnitDetailsGateway.GetOwnerType(unitId); tbxOwnerName.Text = unitInformationUnitDetailsGateway.GetOwnerName(unitId); tbxOwnerContact.Text = unitInformationUnitDetailsGateway.GetOwnerContact(unitId); if (unitInformationUnitDetailsGateway.GetOwnerCountry(unitId).HasValue) { Int64 countryId = (Int64)unitInformationUnitDetailsGateway.GetOwnerCountry(unitId); ddlOwnerCountry.SelectedValue = countryId.ToString(); ProvinceList provinceList = new ProvinceList(); provinceList.LoadByCountryIdAndAddItem(-1, "(Select a state)", countryId); ddlOwnerState.DataSource = provinceList.Table; ddlOwnerState.DataValueField = "ProvinceID"; ddlOwnerState.DataTextField = "Name"; ddlOwnerState.DataBind(); if (unitInformationUnitDetailsGateway.GetOwnerState(unitId).HasValue) { Int64 stateId = (Int64)unitInformationUnitDetailsGateway.GetOwnerState(unitId); ddlOwnerState.SelectedValue = stateId.ToString(); } } } else { tbxOwnerTypeSummary.Text = unitInformationUnitDetailsGateway.GetOwnerType(unitId); tbxOwnerNameSummary.Text = unitInformationUnitDetailsGateway.GetOwnerName(unitId); tbxContactInfoSummary.Text = unitInformationUnitDetailsGateway.GetOwnerContact(unitId); if (unitInformationUnitDetailsGateway.GetOwnerCountry(unitId).HasValue) { Int64 countryId = (Int64)unitInformationUnitDetailsGateway.GetOwnerCountry(unitId); CountryGateway countryGateway = new CountryGateway(); countryGateway.LoadByCountryId(countryId); tbxOwnerCountrySummary.Text = countryGateway.GetName(countryId); if (unitInformationUnitDetailsGateway.GetOwnerState(unitId).HasValue) { Int64 stateId = (Int64)unitInformationUnitDetailsGateway.GetOwnerState(unitId); ProvinceGateway provinceGateway = new ProvinceGateway(); provinceGateway.LoadByProvinceId(stateId); tbxOwnerStateSummary.Text = provinceGateway.GetName(stateId); } } } // Load for Inspection Tab (Qualification data) if (upnlInspectionEdit.Visible) { if (unitInformationUnitDetailsGateway.GetQualifiedDate(unitId).HasValue) { tkrdpQualifiedDate.SelectedDate = unitInformationUnitDetailsGateway.GetQualifiedDate(unitId); } if (unitInformationUnitDetailsGateway.GetNotQualifiedDate(unitId).HasValue) { tkrdpNotQualifiedDate.SelectedDate = (DateTime)unitInformationUnitDetailsGateway.GetNotQualifiedDate(unitId); } tbxIfNotQualifiedExplain.Text = unitInformationUnitDetailsGateway.GetNotQualifiedExplain(unitId); } else { if (unitInformationUnitDetailsGateway.GetQualifiedDate(unitId).HasValue) tbxQualifiedDateSummary.Text = ((DateTime)unitInformationUnitDetailsGateway.GetQualifiedDate(unitId)).ToShortDateString(); if (unitInformationUnitDetailsGateway.GetNotQualifiedDate(unitId).HasValue) tbxNotQualifiedDateSummary.Text = ((DateTime)unitInformationUnitDetailsGateway.GetNotQualifiedDate(unitId)).ToShortDateString(); tbxIfNotQualifiedExplainSummary.Text = unitInformationUnitDetailsGateway.GetNotQualifiedExplain(unitId); } } }
protected void grdInspections_RowDataBound(object sender, GridViewRowEventArgs e) { // Control of footer controls if (e.Row.RowType == DataControlRowType.Footer) { // For Country ((DropDownList)e.Row.FindControl("ddlCountryNew")).SelectedIndex = 0; } // Control of edit controls if ((e.Row.RowType == DataControlRowType.DataRow) && ((e.Row.RowState == DataControlRowState.Edit) || (e.Row.RowState == (DataControlRowState.Edit | DataControlRowState.Alternate)))) { int unitId = Int32.Parse(hdfUnitId.Value); int inspectionId = int.Parse(((Label)e.Row.FindControl("lblInspectionIdEdit")).Text); int companyId = Int32.Parse(hdfCompanyId.Value); DropDownList ddlCountry = ((DropDownList)e.Row.FindControl("ddlCountryEdit")); DropDownList ddlState = ((DropDownList)e.Row.FindControl("ddlStateEdit")); //UnitsInspectionGateway unitsInspectionGateway = new UnitsInspectionGateway(); //unitsInspectionGateway.LoadByUnitIdInspectionId(unitId, inspectionId, companyId); //if (unitsInspectionGateway.Table.Rows.Count > 0) //{ // ((DropDownList)e.Row.FindControl("ddlCountryEdit")).SelectedValue = unitsInspectionGateway.GetCountry(unitId, inspectionId).ToString(); // ((RadDatePicker)e.Row.FindControl("tkrdpInspectionDateEdit")).SelectedDate = unitsInspectionGateway.GetDate_(unitId, inspectionId); //} //else //{ // ddlCountry.SelectedValue = ((DropDownList)e.Row.FindControl("ddlCountryEdit")).SelectedValue; //} UnitInformationInspectionDetailsGateway unitInformationInspectionDetailsForEdit = new UnitInformationInspectionDetailsGateway(unitInformationTDS); try { ddlCountry.SelectedValue = unitInformationInspectionDetailsForEdit.GetCountry(inspectionId).ToString(); ((RadDatePicker)e.Row.FindControl("tkrdpInspectionDateEdit")).SelectedDate = unitInformationInspectionDetailsForEdit.GetDate_(inspectionId); } catch { } ProvinceList provinceList = new ProvinceList(); provinceList.LoadByCountryIdAndAddItem(-1, "(Select a state)", int.Parse(ddlCountry.SelectedValue)); ddlState.DataSource = provinceList.Table; ddlState.DataValueField = "ProvinceID"; ddlState.DataTextField = "Name"; ddlState.DataBind(); try { ddlState.SelectedValue = unitInformationInspectionDetailsForEdit.GetState(inspectionId).ToString(); } catch { } //if (unitsInspectionGateway.Table.Rows.Count > 0) //{ // ddlState.SelectedValue = unitsInspectionGateway.GetState(unitId, inspectionId).ToString(); //} //else //{ // ddlState.SelectedValue = ((DropDownList)e.Row.FindControl("ddlStateEdit")).SelectedValue; //} } }
// //////////////////////////////////////////////////////////////////////// // STEP3 - VEHICLE INFORMATION - METHODS // private void StepVehicleInformationIn() { // Set instruction Label instruction = (Label)this.Master.FindControl("lblInstruction"); instruction.Text = "Please define license plate information"; // ... For country CountryList countryList = new CountryList(); countryList.LoadAndAddItem(-1, "(Select a country)"); ddlLicenseCountry.DataSource = countryList.Table; ddlLicenseCountry.DataValueField = "CountryID"; ddlLicenseCountry.DataTextField = "Name"; ddlLicenseCountry.DataBind(); foreach (int companyLevelId in arrayCompanyLevelsSelected) { if (companyLevelId == 2) { ddlLicenseCountry.SelectedIndex = 1; } if (companyLevelId == 3) { ddlLicenseCountry.SelectedIndex = 2; } } ProvinceList provinceList = new ProvinceList(); provinceList.LoadByCountryIdAndAddItem(-1, "(Select a state)", int.Parse(ddlLicenseCountry.SelectedValue)); ddlLicenseState.DataSource = provinceList.Table; ddlLicenseState.DataValueField = "ProvinceID"; ddlLicenseState.DataTextField = "Name"; ddlLicenseState.DataBind(); ddlLicenseState.SelectedIndex = 0; }
// //////////////////////////////////////////////////////////////////////// // INITIAL EVENTS // protected void Page_Load(object sender, EventArgs e) { // Register client scripts this.RegisterClientScripts(); if (!IsPostBack) { // Security check if (!(Convert.ToBoolean(Session["sgLFS_PROJECTS_VIEW"]) && Convert.ToBoolean(Session["sgLFS_PROJECTS_ADD"]))) { Response.Redirect("./../../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator."); } // Tag page hdfCompanyId.Value = Session["companyID"].ToString(); // Initialize viewstate variables ViewState["StepFrom"] = "Out"; // Store navigator state StoreNavigatorState(); // Prepare initial data // ... for country CountryList countryList = new CountryList(); countryList.LoadAndAddItem(-1, "(Select a country)"); ddlCountry.DataSource = countryList.Table; ddlCountry.DataValueField = "CountryID"; ddlCountry.DataTextField = "Name"; ddlCountry.DataBind(); // ... for office OfficeList officeList = new OfficeList(); officeList.LoadByCountryIdAndAddItem(-1, "(Select an office)", -1); ddlOffice.DataSource = officeList.Table; ddlOffice.DataValueField = "OfficeID"; ddlOffice.DataTextField = "Name"; ddlOffice.DataBind(); // ... for province ProvinceList provinceList = new ProvinceList(); provinceList.LoadByCountryIdAndAddItem(-1, "(Select a province)", -1); ddlProvince.DataSource = provinceList.Table; ddlProvince.DataValueField = "ProvinceID"; ddlProvince.DataTextField = "Name"; ddlProvince.DataBind(); // ... for county CountyList countyList = new CountyList(); countyList.LoadByProvinceIdAndAddItem(-1, "(Select a county)", -1); ddlCounty.DataSource = countyList.Table; ddlCounty.DataValueField = "CountyID"; ddlCounty.DataTextField = "Name"; ddlCounty.DataBind(); // ... for city CityList cityList = new CityList(); cityList.LoadByCountyIdAndAddItem(-1, "(Select a city)", -1); ddlCity.DataSource = cityList.Table; ddlCity.DataValueField = "CityID"; ddlCity.DataTextField = "Name"; ddlCity.DataBind(); // ... for employee EmployeeList employeeList = new EmployeeList(); employeeList.LoadAndAddItem(-1, " "); ddlProjectLead.DataSource = employeeList.Table; ddlProjectLead.DataValueField = "EmployeeID"; ddlProjectLead.DataTextField = "FullName"; ddlProjectLead.DataBind(); // ... for salesman SalesmanList salesmanList = new SalesmanList(); salesmanList.LoadAndAddItem(-1, "(Select a salesman)"); ddlSalesman.DataSource = salesmanList.Table; ddlSalesman.DataValueField = "SalesmanID"; ddlSalesman.DataTextField = "FullName"; ddlSalesman.DataBind(); // StepLocationIn // StepSection1In Wizard.ActiveStepIndex = 0; StepTypeOfProjectIn(); } }