/// <summary> /// Fills data with rows loaded from PrintHoursForProjectsGateway /// </summary> /// <param name="companyId">companyId</param> public void FillData(int companyId) { // Fill rows from original data PrintHoursForProjectOriginalGateway originalGateway = new PrintHoursForProjectOriginalGateway(Data); foreach (PrintHoursForProjectTDS.OriginalRow originalRow in (PrintHoursForProjectTDS.OriginalDataTable)originalGateway.Table) { PrintHoursForProjectTDS.PrintHoursForProjectRow newRow = ((PrintHoursForProjectTDS.PrintHoursForProjectDataTable)Table).NewPrintHoursForProjectRow(); newRow.ClientID = originalRow.ClientID; newRow.ClientName = originalRow.ClientName; newRow.ProjectName = originalRow.ProjectName; newRow.CountryID = originalRow.CountryID; newRow.CountryName = originalRow.CountryName; newRow.EmployeeID = originalRow.EmployeeID; newRow.EmployeeName = originalRow.EmployeeName; newRow.Type = originalRow.Type; newRow.Date_ = originalRow.Date_; if (originalRow.CountryID == 1) { newRow.TimeCA = originalRow.ProjectTime; newRow.TimeUS = 0; } else { newRow.TimeCA = 0; newRow.TimeUS = originalRow.ProjectTime; } if ((originalRow.WorkingDetails == "Sick Day") || (originalRow.WorkingDetails == "Holiday") || (originalRow.WorkingDetails == "Vacation / Other")) { newRow.WorkingDetails = originalRow.WorkingDetails; } else { newRow.WorkingDetails = ""; } if (!originalRow.IsMealsCountryNull()) { if (originalRow.MealsCountry == 1) { newRow.MealsCA = true; newRow.MealsUS = false; newRow.TotalCA = originalRow.MealsAllowance; newRow.TotalUS = 0; } else { newRow.MealsCA = false; newRow.MealsUS = true; newRow.TotalCA = 0; newRow.TotalUS = originalRow.MealsAllowance; } } else { newRow.MealsCA = false; newRow.MealsUS = false; newRow.TotalCA = 0; newRow.TotalUS = 0; } if (!originalRow.IsCommentsNull()) { newRow.Comments = originalRow.Comments; } if (!originalRow.IsUnitIDNull()) { UnitInformationUnitDetailsGateway unitInformationUnitDetailsGatewayForUnit = new UnitInformationUnitDetailsGateway(); unitInformationUnitDetailsGatewayForUnit.LoadAllByUnitId(originalRow.UnitID, companyId); newRow.Unit = unitInformationUnitDetailsGatewayForUnit.GetUnitCode(originalRow.UnitID); } if (!originalRow.IsProjectTimeStateNull()) { newRow.ProjectTimeState = originalRow.ProjectTimeState; } else { newRow.ProjectTimeState = "New"; } if (!originalRow.IsTowedUnitIDNull()) { UnitInformationUnitDetailsGateway unitInformationUnitDetailsGatewayForTowedUnit = new UnitInformationUnitDetailsGateway(); unitInformationUnitDetailsGatewayForTowedUnit.LoadAllByUnitId(originalRow.TowedUnitID, companyId); newRow.Towed = unitInformationUnitDetailsGatewayForTowedUnit.GetUnitCode(originalRow.TowedUnitID); } ((PrintHoursForProjectTDS.PrintHoursForProjectDataTable)Table).AddPrintHoursForProjectRow(newRow); } }
private void LoadDetailedData(int unitId) { UnitInformationUnitDetailsGateway unitInformationUnitDetailsGateway = new UnitInformationUnitDetailsGateway(unitInformationTDS); if (unitInformationUnitDetailsGateway.Table.Rows.Count > 0) { // Load for General Tab if (unitInformationUnitDetailsGateway.GetAcquisitionDate(unitId).HasValue) tbxAcquisitionDate.Text = ((DateTime)unitInformationUnitDetailsGateway.GetAcquisitionDate(unitId)).ToShortDateString(); if (unitInformationUnitDetailsGateway.GetDispositionDate(unitId).HasValue) tbxDispositionDate.Text = ((DateTime)unitInformationUnitDetailsGateway.GetDispositionDate(unitId)).ToShortDateString(); 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); } // Load for Plate and Technical Tabs if (unitInformationUnitDetailsGateway.GetType(unitId) == "Vehicle") { if (unitInformationUnitDetailsGateway.GetLicenseCountry(unitId).HasValue) { Int64 countryId = (Int64)unitInformationUnitDetailsGateway.GetLicenseCountry(unitId); CountryGateway countryGateway = new CountryGateway(); countryGateway.LoadByCountryId(countryId); tbxLicenseCountry.Text = countryGateway.GetName(countryId); } if (unitInformationUnitDetailsGateway.GetLicenseState(unitId).HasValue) { Int64 stateId = (Int64)unitInformationUnitDetailsGateway.GetLicenseState(unitId); ProvinceGateway provinceGateway = new ProvinceGateway(); provinceGateway.LoadByProvinceId(stateId); tbxLicenseState.Text = provinceGateway.GetName(stateId); } tbxLicensePlateNumber.Text = unitInformationUnitDetailsGateway.GetLicensePlateNumbver(unitId); tbxActualWeight.Text = unitInformationUnitDetailsGateway.GetActualWeight(unitId); tbxRegisteredWeight.Text = unitInformationUnitDetailsGateway.GetRegisteredWeight(unitId); tbxTireSizeFront.Text = unitInformationUnitDetailsGateway.GetTireSizeFront(unitId); tbxTireSizeBack.Text = unitInformationUnitDetailsGateway.GetTireSizeBack(unitId); tbxNumberOfAxes.Text = unitInformationUnitDetailsGateway.GetNumberOfAxes(unitId); tbxFuelType.Text = unitInformationUnitDetailsGateway.GetFuelType(unitId); tbxBeginningOdometer.Text = unitInformationUnitDetailsGateway.GetBeginningOdometer(unitId); cbxIsReeferEquipped.Checked = unitInformationUnitDetailsGateway.GetIsReeferEquipped(unitId); cbxIsPtoEquipped.Checked = unitInformationUnitDetailsGateway.GetIsPTOEquipped(unitId); } // Load for Ownership tab tbxOwnerType.Text = unitInformationUnitDetailsGateway.GetOwnerType(unitId); tbxOwnerName.Text = unitInformationUnitDetailsGateway.GetOwnerName(unitId); tbxOwnerContact.Text = unitInformationUnitDetailsGateway.GetOwnerContact(unitId); if (unitInformationUnitDetailsGateway.GetOwnerCountry(unitId).HasValue) { Int64 countryId = (Int64)unitInformationUnitDetailsGateway.GetOwnerCountry(unitId); CountryGateway countryGateway = new CountryGateway(); countryGateway.LoadByCountryId(countryId); tbxOwnerCountry.Text = countryGateway.GetName(countryId); if (unitInformationUnitDetailsGateway.GetOwnerState(unitId).HasValue) { Int64 stateId = (Int64)unitInformationUnitDetailsGateway.GetOwnerState(unitId); ProvinceGateway provinceGateway = new ProvinceGateway(); provinceGateway.LoadByProvinceId(stateId); tbxOwnerState.Text = provinceGateway.GetName(stateId); } } // Load for Inspection Tab (Qualification data) if (unitInformationUnitDetailsGateway.GetQualifiedDate(unitId).HasValue) tbxQualifiedDate.Text = ((DateTime)unitInformationUnitDetailsGateway.GetQualifiedDate(unitId)).ToShortDateString(); if (unitInformationUnitDetailsGateway.GetNotQualifiedDate(unitId).HasValue) tbxNotQualifiedDate.Text = ((DateTime)unitInformationUnitDetailsGateway.GetNotQualifiedDate(unitId)).ToShortDateString(); tbxIfNotQualifiedExplain.Text = unitInformationUnitDetailsGateway.GetNotQualifiedExplain(unitId); } }
private void LoadNotes(int unitId, int companyId) { UnitInformationUnitDetailsGateway unitInformationUnitDetailsGateway = new UnitInformationUnitDetailsGateway(unitInformationTDS); int? libraryCategoriesId = null; if (unitInformationUnitDetailsGateway.GetLibraryCategoriesId(unitId).HasValue) libraryCategoriesId = (int)unitInformationUnitDetailsGateway.GetLibraryCategoriesId(unitId); if (libraryCategoriesId.HasValue) { tbxCategoryAssocited.Text = GetFullCategoryName((int)libraryCategoriesId, companyId); } else { tbxCategoryAssocited.Text = ""; } }
private void Save2() { // Validate data bool validData = true; // For valid data if (validData) { // Validate Ryder Specied if (ddlInsuranceClass.SelectedValue == "Ryder Specified") { Page.Validate("generalSpecial"); } // Notes Gridview, if the gridview is edition mode if (grdNotes.EditIndex >= 0) { grdNotes.UpdateRow(grdNotes.EditIndex, true); } // Inspections Gridview, if the gridview is edition mode if (grdInspections.EditIndex >= 0) { grdInspections.UpdateRow(grdInspections.EditIndex, true); } // Costs Gridview, if the gridview is edition mode if (grdCosts.EditIndex >= 0) { grdCosts.UpdateRow(grdCosts.EditIndex, true); } // Costs Exceptions Gridview, if the gridview is edition mode if (grdCostsExceptions.EditIndex >= 0) { grdCostsExceptions.UpdateRow(grdCostsExceptions.EditIndex, true); } // If there is data at the footers GrdNotesAdd(); InspectionsAddNew(); GrdCostsAdd(); GrdCostsExceptionsAdd(); // Basic int companyId = Int32.Parse(hdfCompanyId.Value); int unitId = Int32.Parse(hdfUnitId.Value); // General string code = tbxCode.Text; string description = ""; if (tbxDescription.Text != "") description = tbxDescription.Text; string vin = ""; if (tbxVinSn.Text != "") vin = tbxVinSn.Text; string manufacturer = ""; if (tbxManufacturer.Text != "") manufacturer = tbxManufacturer.Text; string model = ""; if (tbxModel.Text != "") model = tbxModel.Text; string year = ""; if (tbxYear.Text != "") year = tbxYear.Text; bool isTowable = (cbxIsTowable.Checked) ? isTowable = true : isTowable = false; int companyLevelIdSelected = 0; arrayCompanyLevelsSelectedForEdit.Clear(); foreach (TreeNode nodes in tvCompanyLevelsRoot.Nodes) { GetCompanyLevelsSelected(nodes); } DateTime? acquisitionDate = null; if (tkrdpAcquisitionDate.SelectedDate.HasValue) acquisitionDate = tkrdpAcquisitionDate.SelectedDate.Value; DateTime? dispositionDate = null; if (tkrdpDispositionDate.SelectedDate.HasValue) dispositionDate = tkrdpDispositionDate.SelectedDate.Value; string dispositionReason = ""; if (tbxDispositionReason.Text != "") dispositionReason = tbxDispositionReason.Text; foreach (int companyLevelId in arrayCompanyLevelsSelectedForEdit) { companyLevelIdSelected = companyLevelId; } // Plate Int64? licenseCountry = null; Int64? licenceState = null; string licensePlateNumber = ""; if (tbxLicensePlateNumber.Text != "") licensePlateNumber = tbxLicensePlateNumber.Text; string apportionedTagNumber = ""; // This field will not be shown // Technical string actualWeight = ""; string registeredWeight = ""; string tireSizeFront = ""; string tireSizeBack = ""; string numberOfAxes = ""; string fuelType = ""; string beginningOdometer = ""; if (tbxBeginningOdometer.Text != "") beginningOdometer = tbxBeginningOdometer.Text; bool isRefeerEquipped = cbxIsReeferEquipped.Checked; bool isPtoEquipped = cbxIsPtoEquipped.Checked; if (hdfUnitType.Value == "Vehicle") { if (ddlLicenseCountry.SelectedValue != "-1") { licenseCountry = Int64.Parse(ddlLicenseCountry.SelectedValue); if (licenseCountry.ToString() == "1") { // Ontario hdfLicenseStateId.Value = "12435"; licenceState = Int64.Parse(hdfLicenseStateId.Value); } else { if (licenseCountry.ToString() == "2") { // Michigan hdfLicenseStateId.Value = "84026"; licenceState = Int64.Parse(hdfLicenseStateId.Value); } } } actualWeight = tbxActualWeight.Text; registeredWeight = tbxRegisteredWeight.Text; tireSizeFront = tbxTireSizeFront.Text; tireSizeBack = tbxTireSizeBack.Text; numberOfAxes = ddlNumberOfAxes.SelectedValue; fuelType = ddlFuelType.SelectedValue; } // Ownership string ownerType = ddlOwnerType.SelectedValue; Int64? ownerCountry = null; Int64? ownerState = null; string ownerName = ""; if (tbxOwnerName.Text != "") ownerName = tbxOwnerName.Text; string ownerContact = ""; if (tbxOwnerContact.Text != "") ownerContact = tbxOwnerContact.Text; if (ddlOwnerCountry.SelectedValue != "-1") { ownerCountry = Int64.Parse(ddlOwnerCountry.SelectedValue); if (ddlOwnerState.SelectedValue != "-1") { ownerState = Int64.Parse(ddlOwnerState.SelectedValue); } } // Qualification Details DateTime? qualifiedDate = null; if (tkrdpQualifiedDate.SelectedDate.HasValue) qualifiedDate = tkrdpQualifiedDate.SelectedDate.Value; DateTime? notQualifiedDate = null; if (tkrdpNotQualifiedDate.SelectedDate.HasValue) notQualifiedDate = tkrdpNotQualifiedDate.SelectedDate.Value; string notQualifiedExplain = ""; if (tbxIfNotQualifiedExplain.Text != "") notQualifiedExplain = tbxIfNotQualifiedExplain.Text; string insuranceClass = ddlInsuranceClass.SelectedValue; string insuranceClassRyderSpecified = ""; if (ddlInsuranceClass.SelectedValue == "Ryder Specified") { insuranceClassRyderSpecified = tbxRyderSpecified.Text; } decimal? purchasePrice = null; if (tbxPurchasePrice.Text != "") purchasePrice = Convert.ToDecimal(tbxPurchasePrice.Text); DateTime? scrapDate = null; if (tkrdpScrapDate.SelectedDate.HasValue) scrapDate = tkrdpScrapDate.SelectedDate.Value; decimal? saleProceeds = null; if (tbxSaleProceeds.Text != "") saleProceeds = Convert.ToDecimal(tbxSaleProceeds.Text); UnitInformationUnitDetailsGateway UnitInformationUnitDetailsGateway = new UnitInformationUnitDetailsGateway(unitInformationTDS); int? libraryCategoriesId = null; if (UnitInformationUnitDetailsGateway.GetLibraryCategoriesId(int.Parse(hdfUnitId.Value)).HasValue) libraryCategoriesId = (int)UnitInformationUnitDetailsGateway.GetLibraryCategoriesId(int.Parse(hdfUnitId.Value)); // Update unit data UnitInformationUnitDetails unitInformationUnitDetails = new UnitInformationUnitDetails(unitInformationTDS); unitInformationUnitDetails.Update(unitId, code, description, vin, manufacturer, model, year, isTowable, companyLevelIdSelected, acquisitionDate, dispositionDate, dispositionReason, licenseCountry, licenceState, licensePlateNumber, apportionedTagNumber, actualWeight, registeredWeight, tireSizeFront, tireSizeBack, numberOfAxes, fuelType, beginningOdometer, isRefeerEquipped, isPtoEquipped, ownerType, ownerCountry, ownerState, ownerName, ownerContact, qualifiedDate, notQualifiedDate, notQualifiedExplain, insuranceClass, insuranceClassRyderSpecified, purchasePrice, scrapDate, saleProceeds, libraryCategoriesId); Session["arrayCategoriesSelectedForEdit"] = arrayCategoriesSelectedForEdit; Session["arrayCompanyLevelsSelectedForEdit"] = arrayCompanyLevelsSelectedForEdit; // Store dataset Session["unitInformationTDS"] = unitInformationTDS; Session["categoriesTDSForUnits"] = categoriesTDS; Session["companyLevelsTDS"] = companyLevelsTDS; ViewState["update"] = "no"; } }
private void LoadBasicData(int unitId) { UnitInformationUnitDetailsGateway unitInformationUnitDetailsGateway = new UnitInformationUnitDetailsGateway(unitInformationTDS); if (unitInformationUnitDetailsGateway.Table.Rows.Count > 0) { // Load unit basic data tbxUnitState.Text = unitInformationUnitDetailsGateway.GetState(unitId); tbxCode.Text = unitInformationUnitDetailsGateway.GetUnitCode(unitId); tbxDescription.Text = unitInformationUnitDetailsGateway.GetDescription(unitId); tbxVinSn.Text = unitInformationUnitDetailsGateway.GetVin(unitId); tbxManufacturer.Text = unitInformationUnitDetailsGateway.GetManufacturer(unitId); tbxModel.Text = unitInformationUnitDetailsGateway.GetModel(unitId); tbxYear.Text = unitInformationUnitDetailsGateway.GetYear_(unitId); if (unitInformationUnitDetailsGateway.GetIsTowable(unitId)) cbxIsTowable.Checked = true; else cbxIsTowable.Checked = false; tbxInsuranceClass.Text = unitInformationUnitDetailsGateway.GetInsuranceClass(unitId); if (unitInformationUnitDetailsGateway.GetInsuranceClass(unitId) == "Ryder Specified") { lblRyderSpecified.Visible = true; tbxRyderSpecified.Visible = true; tbxRyderSpecified.Text = unitInformationUnitDetailsGateway.GetInsuranceClassRyderSpecified(unitId); } else { lblRyderSpecified.Visible = false; tbxRyderSpecified.Visible = false; } tbxPurchasePrice.Text = ""; if (unitInformationUnitDetailsGateway.GetPurchasePrice(unitId).HasValue) tbxPurchasePrice.Text = Math.Round(unitInformationUnitDetailsGateway.GetPurchasePrice(unitId).Value, 2).ToString(); tbxScrapDate.Text = ""; if (unitInformationUnitDetailsGateway.GetScrapDate(unitId).HasValue) tbxScrapDate.Text = unitInformationUnitDetailsGateway.GetScrapDate(unitId).Value.ToShortDateString(); tbxSaleProceeds.Text = ""; if (unitInformationUnitDetailsGateway.GetSaleProceeds(unitId).HasValue) tbxSaleProceeds.Text = Math.Round(unitInformationUnitDetailsGateway.GetSaleProceeds(unitId).Value, 2).ToString(); } }
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); } } }
private void LoadNotes() { UnitInformationUnitDetailsGateway unitInformationUnitDetailsGateway = new UnitInformationUnitDetailsGateway(unitInformationTDS); int? libraryCategoriesId = null; if (unitInformationUnitDetailsGateway.GetLibraryCategoriesId(int.Parse(hdfUnitId.Value)).HasValue) libraryCategoriesId = (int)unitInformationUnitDetailsGateway.GetLibraryCategoriesId(int.Parse(hdfUnitId.Value)); if (libraryCategoriesId.HasValue) { ViewState["libraryCategoriesId"] = (int)libraryCategoriesId; tbxCategoryAssocited.Text = GetFullCategoryName((int)libraryCategoriesId); btnAssociate.Visible = false; btnUnassociate.Visible = true; } else { tbxCategoryAssocited.Text = ""; btnAssociate.Visible = true; btnUnassociate.Visible = false; } }
private void LoadBasicData(int unitId) { UnitInformationUnitDetailsGateway unitInformationUnitDetailsGateway = new UnitInformationUnitDetailsGateway(unitInformationTDS); if (unitInformationUnitDetailsGateway.Table.Rows.Count > 0) { // Load unit basic data tbxUnitState.Text = unitInformationUnitDetailsGateway.GetState(unitId); tbxCode.Text = unitInformationUnitDetailsGateway.GetUnitCode(unitId); tbxDescription.Text = unitInformationUnitDetailsGateway.GetDescription(unitId); tbxVinSn.Text = unitInformationUnitDetailsGateway.GetVin(unitId); tbxManufacturer.Text = unitInformationUnitDetailsGateway.GetManufacturer(unitId); tbxModel.Text = unitInformationUnitDetailsGateway.GetModel(unitId); tbxYear.Text = unitInformationUnitDetailsGateway.GetYear_(unitId); if (unitInformationUnitDetailsGateway.GetIsTowable(unitId)) cbxIsTowable.Checked = true; else cbxIsTowable.Checked = false; if (!String.IsNullOrEmpty(unitInformationUnitDetailsGateway.GetInsuranceClass(unitId))) ddlInsuranceClass.SelectedValue = unitInformationUnitDetailsGateway.GetInsuranceClass(unitId); if (unitInformationUnitDetailsGateway.GetInsuranceClass(unitId) == "Ryder Specified") { lblRyderSpecified.Visible = true; tbxRyderSpecified.Visible = true; tbxRyderSpecified.Text = unitInformationUnitDetailsGateway.GetInsuranceClassRyderSpecified(unitId); upnlRyderSpecifiedLabel.Update(); upnlRyderSpecified.Update(); } // Load for General Tab if (upnlGeneralDataEdit.Visible) { tbxPurchasePrice.Text = ""; if (unitInformationUnitDetailsGateway.GetPurchasePrice(unitId).HasValue) tbxPurchasePrice.Text = Math.Round(unitInformationUnitDetailsGateway.GetPurchasePrice(unitId).Value, 2).ToString(); tkrdpScrapDate.SelectedDate = null; if (unitInformationUnitDetailsGateway.GetScrapDate(unitId).HasValue) tkrdpScrapDate.SelectedDate = (DateTime)unitInformationUnitDetailsGateway.GetScrapDate(unitId); tbxSaleProceeds.Text = ""; if (unitInformationUnitDetailsGateway.GetSaleProceeds(unitId).HasValue) tbxSaleProceeds.Text = Math.Round(unitInformationUnitDetailsGateway.GetSaleProceeds(unitId).Value, 2).ToString(); } else { tbxPurchasePriceSummary.Text = ""; if (unitInformationUnitDetailsGateway.GetPurchasePrice(unitId).HasValue) tbxPurchasePriceSummary.Text = Math.Round(unitInformationUnitDetailsGateway.GetPurchasePrice(unitId).Value, 2).ToString(); tbxScrapDateSummary.Text = ""; if (unitInformationUnitDetailsGateway.GetScrapDate(unitId).HasValue) tbxScrapDateSummary.Text = unitInformationUnitDetailsGateway.GetScrapDate(unitId).Value.ToShortDateString(); tbxSaleProceedsSummary.Text = ""; if (unitInformationUnitDetailsGateway.GetSaleProceeds(unitId).HasValue) tbxSaleProceedsSummary.Text = Math.Round(unitInformationUnitDetailsGateway.GetSaleProceeds(unitId).Value, 2).ToString(); } } }
protected void grdNotes_RowDataBound(object sender, GridViewRowEventArgs e) { // Edit items if ((e.Row.RowType == DataControlRowType.DataRow) && ((e.Row.RowState == DataControlRowState.Edit) || (e.Row.RowState == (DataControlRowState.Edit | DataControlRowState.Alternate)))) { string originalFileNameEdit = ((TextBox)e.Row.FindControl("tbxNoteAttachmentEdit")).Text; string fileName = ((Label)e.Row.FindControl("lblFileNameEdit")).Text; int libraryFileId = 0; if (((Label)e.Row.FindControl("lblLibraryFileIdEdit")).Text != "") libraryFileId = Int32.Parse(((Label)e.Row.FindControl("lblLibraryFileIdEdit")).Text); // Button visibility if (originalFileNameEdit == "") { ((Button)e.Row.FindControl("btnNoteDeleteEdit")).Visible = false; UnitInformationUnitDetailsGateway unitInformationUnitDetailsGateway = new UnitInformationUnitDetailsGateway(unitInformationTDS); int? libraryCategoriesId = null; if (unitInformationUnitDetailsGateway.GetLibraryCategoriesId(int.Parse(hdfUnitId.Value)).HasValue) libraryCategoriesId = (int)unitInformationUnitDetailsGateway.GetLibraryCategoriesId(int.Parse(hdfUnitId.Value)); if (libraryCategoriesId.HasValue) { ((Button)e.Row.FindControl("btnNoteAddEdit")).Visible = true; } else { ((Button)e.Row.FindControl("btnNoteAddEdit")).Visible = false; } } else { ((Button)e.Row.FindControl("btnNoteDeleteEdit")).Visible = true; ((Button)e.Row.FindControl("btnNoteAddEdit")).Visible = false; } } // Normal items if ((e.Row.RowType == DataControlRowType.DataRow) && ((e.Row.RowState == DataControlRowState.Normal) || (e.Row.RowState == (DataControlRowState.Normal | DataControlRowState.Alternate)))) { string originalFileName = ((TextBox)e.Row.FindControl("tbxNoteAttachment")).Text; string fileName = ((Label)e.Row.FindControl("lblFileName")).Text; int libraryFileId = 0; if (((Label)e.Row.FindControl("lblLibraryFileId")).Text != "") libraryFileId = Int32.Parse(((Label)e.Row.FindControl("lblLibraryFileId")).Text); // Button visibility if (originalFileName == "") { ((Button)e.Row.FindControl("btnNoteDownload")).Visible = false; } else { ((Button)e.Row.FindControl("btnNoteDownload")).Visible = true; } } // Footer item if (e.Row.RowType == DataControlRowType.Footer) { UnitInformationUnitDetailsGateway unitInformationUnitDetailsGateway = new UnitInformationUnitDetailsGateway(unitInformationTDS); int? libraryCategoriesId = null; if (unitInformationUnitDetailsGateway.GetLibraryCategoriesId(int.Parse(hdfUnitId.Value)).HasValue) libraryCategoriesId = (int)unitInformationUnitDetailsGateway.GetLibraryCategoriesId(int.Parse(hdfUnitId.Value)); if (libraryCategoriesId.HasValue) { ((Button)e.Row.FindControl("btnAddFooter")).Visible = true; } else { ((Button)e.Row.FindControl("btnAddFooter")).Visible = false; } } }
/// <summary> /// Save /// </summary> /// <param name="categoriesSelected">categoriesSelected</param> /// <param name="companyId">companyId</param> public void Save(ArrayList categoriesSelected, int companyId) { UnitInformationTDS unitsInformationChanges = (UnitInformationTDS)Data.GetChanges(); if (unitsInformationChanges.UnitDetails.Rows.Count > 0) { UnitInformationUnitDetailsGateway unitInformationUnitDetailsGateway = new UnitInformationUnitDetailsGateway(unitsInformationChanges); // Update unit foreach (UnitInformationTDS.UnitDetailsRow unitDetailsRow in (UnitInformationTDS.UnitDetailsDataTable)unitsInformationChanges.UnitDetails) { // Unchanged values int unitId = unitDetailsRow.UnitID; string state = unitInformationUnitDetailsGateway.GetState(unitId); string type = unitInformationUnitDetailsGateway.GetType(unitId); bool deleted = false; string notes = ""; if (!unitDetailsRow.IsNotesNull()) notes = unitDetailsRow.Notes; string originalCategories = ""; if (!unitDetailsRow.IsCategoriesNull()) originalCategories = unitDetailsRow.Categories; // Original Unit values string originalUnitCode = unitInformationUnitDetailsGateway.GetUnitCodeOriginal(unitId); string originalDescription = unitInformationUnitDetailsGateway.GetDescriptionOriginal(unitId); string originalVin = unitInformationUnitDetailsGateway.GetVinOriginal(unitId); string originalManufacturer = unitInformationUnitDetailsGateway.GetManufacturerOriginal(unitId); string originalModel = unitInformationUnitDetailsGateway.GetModelOriginal(unitId); string originalYear_ = unitInformationUnitDetailsGateway.GetYear_Original(unitId); bool originalIsTowable = unitInformationUnitDetailsGateway.GetIsTowableOriginal(unitId); int originalCompanyLevelId = unitInformationUnitDetailsGateway.GetCompanyLevelIdOriginal(unitId); DateTime? originalAcquisitionDate = null; if (unitInformationUnitDetailsGateway.GetAcquisitionDateOriginal(unitId).HasValue) originalAcquisitionDate = (DateTime)unitInformationUnitDetailsGateway.GetAcquisitionDateOriginal(unitId); DateTime? originalDispositionDate = null; if (unitInformationUnitDetailsGateway.GetDispositionDateOriginal(unitId).HasValue) originalDispositionDate = (DateTime)unitInformationUnitDetailsGateway.GetDispositionDateOriginal(unitId); string originalDispositionReason = unitInformationUnitDetailsGateway.GetDispositionReasonOriginal(unitId); string originalOwnerType = unitInformationUnitDetailsGateway.GetOwnerTypeOriginal(unitId); Int64? originalOwnerCountry = null; if (unitInformationUnitDetailsGateway.GetOwnerCountryOriginal(unitId).HasValue) originalOwnerCountry = (Int64)unitInformationUnitDetailsGateway.GetOwnerCountryOriginal(unitId); Int64? originalOwnerState = null; if (unitInformationUnitDetailsGateway.GetOwnerStateOriginal(unitId).HasValue) originalOwnerState = (Int64)unitInformationUnitDetailsGateway.GetOwnerStateOriginal(unitId); string originalOwnerName = unitInformationUnitDetailsGateway.GetOwnerNameOriginal(unitId); string originalOwnerContact = unitInformationUnitDetailsGateway.GetOwnerContactOriginal(unitId); DateTime? originalQualifiedDate = null; if (unitInformationUnitDetailsGateway.GetQualifiedDateOriginal(unitId).HasValue) originalQualifiedDate = (DateTime)unitInformationUnitDetailsGateway.GetQualifiedDateOriginal(unitId); DateTime? originalNotQualifiedDate = null; if (unitInformationUnitDetailsGateway.GetNotQualifiedDateOriginal(unitId).HasValue) originalNotQualifiedDate = (DateTime)unitInformationUnitDetailsGateway.GetNotQualifiedDateOriginal(unitId); string originalNotQualifiedExplain = unitInformationUnitDetailsGateway.GetNotQualifiedExplainOriginal(unitId); string originalInsuranceClass = unitInformationUnitDetailsGateway.GetInsuranceClassOriginal(unitId); string originalInsuranceClassRyderSpecified = unitInformationUnitDetailsGateway.GetInsuranceClassRyderSpecifiedOriginal(unitId); decimal? originalPurchasePrice = null; if (unitInformationUnitDetailsGateway.GetPurchasePriceOriginal(unitId).HasValue) originalPurchasePrice = unitInformationUnitDetailsGateway.GetPurchasePriceOriginal(unitId).Value; DateTime? originalScrapDate = null; if (unitInformationUnitDetailsGateway.GetScrapDateOriginal(unitId).HasValue) originalScrapDate = (DateTime)unitInformationUnitDetailsGateway.GetScrapDateOriginal(unitId); decimal? originalSaleProceeds = null; if (unitInformationUnitDetailsGateway.GetSaleProceedsOriginal(unitId).HasValue) originalSaleProceeds = unitInformationUnitDetailsGateway.GetSaleProceedsOriginal(unitId).Value; int? originalLibraryCategoriesId = null; if (unitInformationUnitDetailsGateway.GetLibraryCategoriesIdOriginal(unitId).HasValue) originalLibraryCategoriesId = unitInformationUnitDetailsGateway.GetLibraryCategoriesIdOriginal(unitId).Value; // New Unit values string newUnitCode = unitInformationUnitDetailsGateway.GetUnitCode(unitId); string newDescription = unitInformationUnitDetailsGateway.GetDescription(unitId); string newVin = unitInformationUnitDetailsGateway.GetVin(unitId); string newManufacturer = unitInformationUnitDetailsGateway.GetManufacturer(unitId); string newModel = unitInformationUnitDetailsGateway.GetModel(unitId); string newYear_ = unitInformationUnitDetailsGateway.GetYear_(unitId); bool newIsTowable = unitInformationUnitDetailsGateway.GetIsTowable(unitId); int newCompanyLevelId = unitInformationUnitDetailsGateway.GetCompanyLevelId(unitId); DateTime? newAcquisitionDate = null; if (unitInformationUnitDetailsGateway.GetAcquisitionDate(unitId).HasValue) newAcquisitionDate = (DateTime)unitInformationUnitDetailsGateway.GetAcquisitionDate(unitId); DateTime? newDispositionDate = null; if (unitInformationUnitDetailsGateway.GetDispositionDate(unitId).HasValue) newDispositionDate = (DateTime)unitInformationUnitDetailsGateway.GetDispositionDate(unitId); string newDispositionReason = unitInformationUnitDetailsGateway.GetDispositionReason(unitId); string newOwnerType = unitInformationUnitDetailsGateway.GetOwnerType(unitId); Int64? newOwnerCountry = null; if (unitInformationUnitDetailsGateway.GetOwnerCountry(unitId).HasValue) newOwnerCountry = (Int64)unitInformationUnitDetailsGateway.GetOwnerCountry(unitId); Int64? newOwnerState = null; if (unitInformationUnitDetailsGateway.GetOwnerState(unitId).HasValue) newOwnerState = (Int64)unitInformationUnitDetailsGateway.GetOwnerState(unitId); string newOwnerName = unitInformationUnitDetailsGateway.GetOwnerName(unitId); string newOwnerContact = unitInformationUnitDetailsGateway.GetOwnerContact(unitId); DateTime? newQualifiedDate = null; if (unitInformationUnitDetailsGateway.GetQualifiedDate(unitId).HasValue) newQualifiedDate = (DateTime)unitInformationUnitDetailsGateway.GetQualifiedDate(unitId); DateTime? newNotQualifiedDate = null; if (unitInformationUnitDetailsGateway.GetNotQualifiedDate(unitId).HasValue) newNotQualifiedDate = (DateTime)unitInformationUnitDetailsGateway.GetNotQualifiedDate(unitId); string newNotQualifiedExplain = unitInformationUnitDetailsGateway.GetNotQualifiedExplain(unitId); string newCategories = ""; if (categoriesSelected.Count > 0) { foreach (int categoryId in categoriesSelected) { CategoryGateway categoryGateway = new CategoryGateway(); categoryGateway.LoadByCategoryId(categoryId, companyId); newCategories = newCategories + categoryGateway.GetName(categoryId) + ", "; } if (newCategories.Length > 2) { newCategories = newCategories.Substring(0, newCategories.Length - 2); } } string newInsuranceClass = unitInformationUnitDetailsGateway.GetInsuranceClass(unitId); string newInsuranceClassRyderSpecified = unitInformationUnitDetailsGateway.GetInsuranceClassRyderSpecified(unitId); decimal? newPurchasePrice = null; if (unitInformationUnitDetailsGateway.GetPurchasePrice(unitId).HasValue) newPurchasePrice = unitInformationUnitDetailsGateway.GetPurchasePrice(unitId).Value; DateTime? newScrapDate = null; if (unitInformationUnitDetailsGateway.GetScrapDate(unitId).HasValue) newScrapDate = (DateTime)unitInformationUnitDetailsGateway.GetScrapDate(unitId); decimal? newSaleProceeds = null; if (unitInformationUnitDetailsGateway.GetSaleProceeds(unitId).HasValue) newSaleProceeds = unitInformationUnitDetailsGateway.GetSaleProceeds(unitId).Value; int? newLibraryCategoriesId = null; if (unitInformationUnitDetailsGateway.GetLibraryCategoriesId(unitId).HasValue) newLibraryCategoriesId = unitInformationUnitDetailsGateway.GetLibraryCategoriesId(unitId).Value; // Update unit UpdateUnit(unitId, originalUnitCode, originalDescription, originalVin, originalManufacturer, originalModel, originalYear_, originalIsTowable, originalCompanyLevelId, originalAcquisitionDate, originalDispositionDate, originalDispositionReason, originalOwnerType, originalOwnerCountry, originalOwnerState, originalOwnerName, originalOwnerContact, originalQualifiedDate, originalNotQualifiedDate, originalNotQualifiedExplain, state, type, deleted, companyId, notes, originalCategories, originalInsuranceClass, originalInsuranceClassRyderSpecified, originalPurchasePrice, originalScrapDate, originalSaleProceeds, originalLibraryCategoriesId, unitId, newUnitCode, newDescription, newVin, newManufacturer, newModel, newYear_, newIsTowable, newCompanyLevelId, newAcquisitionDate, newDispositionDate, newDispositionReason, newOwnerType, newOwnerCountry, newOwnerState, newOwnerName, newOwnerContact, newQualifiedDate, newNotQualifiedDate, newNotQualifiedExplain, state, type, deleted, companyId, notes, newCategories, newInsuranceClass, newInsuranceClassRyderSpecified, newPurchasePrice, newScrapDate, newSaleProceeds, newLibraryCategoriesId); UpdateUnitCategory(unitId, companyId, categoriesSelected, newCompanyLevelId); if (type == "Vehicle") { // Original Unit Vehicle values Int64? originalLicenseCountry = null; if (unitInformationUnitDetailsGateway.GetLicenseCountryOriginal(unitId).HasValue) originalLicenseCountry = (Int64)unitInformationUnitDetailsGateway.GetLicenseCountryOriginal(unitId); Int64? originalLicenseState = null; if (unitInformationUnitDetailsGateway.GetLicenseStateOriginal(unitId).HasValue) originalLicenseState = (Int64)unitInformationUnitDetailsGateway.GetLicenseStateOriginal(unitId); string originalLicensePlateNumber = unitInformationUnitDetailsGateway.GetLicensePlateNumbverOriginal(unitId); string originalAportionedTagNumber = unitInformationUnitDetailsGateway.GetAportionedTagNumberOriginal(unitId); string originalActualWeight = unitInformationUnitDetailsGateway.GetActualWeightOriginal(unitId); string originalRegisteredWeight = unitInformationUnitDetailsGateway.GetRegisteredWeightOriginal(unitId); string originalTireSizeFront = unitInformationUnitDetailsGateway.GetTireSizeFrontOriginal(unitId); string originalTireSizeBack = unitInformationUnitDetailsGateway.GetTireSizeBackOriginal(unitId); string originalNumberOfAxes = unitInformationUnitDetailsGateway.GetNumberOfAxesOriginal(unitId); string originalFuelType = unitInformationUnitDetailsGateway.GetFuelTypeOriginal(unitId); string originalBeginningOdometer = unitInformationUnitDetailsGateway.GetBeginningOdometerOriginal(unitId); bool originalIsReeferEquipped = unitInformationUnitDetailsGateway.GetIsReeferEquippedOriginal(unitId); bool originalIsPtoEquipped = unitInformationUnitDetailsGateway.GetIsPTOEquippedOriginal(unitId); // New Unit Vehicle values Int64? newLicenseCountry = null; if (unitInformationUnitDetailsGateway.GetLicenseCountry(unitId).HasValue) newLicenseCountry = (Int64)unitInformationUnitDetailsGateway.GetLicenseCountry(unitId); Int64? newLicenseState = null; if (unitInformationUnitDetailsGateway.GetLicenseState(unitId).HasValue) newLicenseState = (Int64)unitInformationUnitDetailsGateway.GetLicenseState(unitId); string newLicensePlateNumber = unitInformationUnitDetailsGateway.GetLicensePlateNumbver(unitId); string newAportionedTagNumber = unitInformationUnitDetailsGateway.GetAportionedTagNumber(unitId); string newActualWeight = unitInformationUnitDetailsGateway.GetActualWeight(unitId); string newRegisteredWeight = unitInformationUnitDetailsGateway.GetRegisteredWeight(unitId); string newTireSizeFront = unitInformationUnitDetailsGateway.GetTireSizeFront(unitId); string newTireSizeBack = unitInformationUnitDetailsGateway.GetTireSizeBack(unitId); string newNumberOfAxes = unitInformationUnitDetailsGateway.GetNumberOfAxes(unitId); string newFuelType = unitInformationUnitDetailsGateway.GetFuelType(unitId); string newBeginningOdometer = unitInformationUnitDetailsGateway.GetBeginningOdometer(unitId); bool newIsReeferEquipped = unitInformationUnitDetailsGateway.GetIsReeferEquipped(unitId); bool newIsPtoEquipped = unitInformationUnitDetailsGateway.GetIsPTOEquipped(unitId); UpdateUnitVehicle(unitId, originalLicenseCountry, originalLicenseState, originalLicensePlateNumber, originalAportionedTagNumber, originalActualWeight, originalRegisteredWeight, originalTireSizeFront, originalTireSizeBack, originalNumberOfAxes, originalFuelType, originalBeginningOdometer, originalIsReeferEquipped, originalIsPtoEquipped, deleted, companyId, unitId, newLicenseCountry, newLicenseState, newLicensePlateNumber, newAportionedTagNumber, newActualWeight, newRegisteredWeight, newTireSizeFront, newTireSizeBack, newNumberOfAxes, newFuelType, newBeginningOdometer, newIsReeferEquipped, newIsPtoEquipped, deleted, companyId); } } } }
// //////////////////////////////////////////////////////////////////////// // PUBLIC METHODS // /// <summary> /// LoadByUnitId /// </summary> /// <param name="unitId">unitId</param> /// <param name="companyId">companyId</param> public void LoadByUnitId(int unitId, int companyId) { UnitInformationUnitDetailsGateway unitInformationUnitDetailsGateway = new UnitInformationUnitDetailsGateway(Data); unitInformationUnitDetailsGateway.LoadByUnitId(unitId, companyId); }
/// <summary> /// SaveState /// </summary> /// <param name="companyId">companyId</param> /// <param name="newState">newState</param> public void SaveState(int companyId, string newState) { UnitInformationTDS unitsInformationChanges = (UnitInformationTDS)Data.GetChanges(); if (unitsInformationChanges.UnitDetails.Rows.Count > 0) { UnitInformationUnitDetailsGateway unitInformationUnitDetailsGateway = new UnitInformationUnitDetailsGateway(unitsInformationChanges); // Update unit state foreach (UnitInformationTDS.UnitDetailsRow unitDetailsRow in (UnitInformationTDS.UnitDetailsDataTable)unitsInformationChanges.UnitDetails) { // Unchanged values int unitId = unitDetailsRow.UnitID; string state = unitDetailsRow.State; UpdateUnitState(unitId, companyId, state); if (newState == "Disposed") { DeleteChecklists(unitId, companyId); } if (newState == "Removed") { DeleteChecklists(unitId, companyId); } } } }