Пример #1
0
        /// <summary>
        /// DeleteDirect
        /// </summary>
        /// <param name="unitId">unitId</param>
        /// <param name="unitType">unitType</param>
        /// <param name="companyId">companyId</param>
        public void DeleteDirect(int unitId, string unitType, int companyId)
        {
            UnitsGateway unitsGateway = new UnitsGateway();
            unitsGateway.LoadByUnitId(unitId,  companyId);

            if (unitsGateway.Table.Rows.Count > 0)
            {
                // ... Delete unit categories
                UnitsCategory unitsCategory = new UnitsCategory(null);
                UnitsCategoryGateway unitsCategoryGateway = new UnitsCategoryGateway();
                unitsCategoryGateway.LoadByUnitId(unitId, companyId);

                foreach (UnitsTDS.LFS_FM_UNIT_CATEGORYRow rowCategories in (UnitsTDS.LFS_FM_UNIT_CATEGORYDataTable)unitsCategoryGateway.Table)
                {
                    unitsCategory.DeleteDirect(unitId, rowCategories.CategoryID, companyId);
                }

                // ... if vehicle type then delete unit
                if (unitType == "Vehicle")
                {
                    UnitsVehicle unitsVehicle = new UnitsVehicle(null);
                    unitsVehicle.DeleteDirect(unitId, companyId);
                }

                // ... Delete inspections
                UnitsInspection unitsInspection = new UnitsInspection(null);
                UnitsInspectionGateway unitsInspectionGateway = new UnitsInspectionGateway();
                unitsInspectionGateway.LoadByUnitId(unitId, companyId);

                foreach (UnitsTDS.LFS_FM_UNIT_INSPECTIONRow rowInspections in (UnitsTDS.LFS_FM_UNIT_INSPECTIONDataTable)unitsInspectionGateway.Table)
                {
                    unitsInspection.DeletedDirect(unitId, rowInspections.InspectionID, companyId);
                }

                // ... Delete unit
                unitsGateway.Delete(unitId, companyId);
            }
        }
 /// <summary>
 /// UpdateUnitVehicle
 /// </summary>
 /// <param name="originalUnitId">originalUnitId</param>
 /// <param name="originalLicenseCountry">originalLicenseCountry</param>
 /// <param name="originalLicenseState">originalLicenseState</param>
 /// <param name="originalLicensePlateNumbver">originalLicensePlateNumbver</param>
 /// <param name="originalAportionedTagNumber">originalAportionedTagNumber</param>
 /// <param name="originalActualWeight">originalActualWeight</param>
 /// <param name="originalRegisteredWeight">originalRegisteredWeight</param>
 /// <param name="originalTireSizeFront">originalTireSizeFront</param>
 /// <param name="originalTireSizeBack">originalTireSizeBack</param>
 /// <param name="originalNumberOfAxes">originalNumberOfAxes</param>
 /// <param name="originalFuelType">originalFuelType</param>
 /// <param name="originalBeginningOdometer">originalBeginningOdometer</param>
 /// <param name="originalIsReeferEquipped">originalIsReeferEquipped</param>
 /// <param name="originalIsPTOEquipped">originalIsPTOEquipped</param>
 /// <param name="originalDeleted">originalDeleted</param>
 /// <param name="originalCompanyId">originalCompanyId</param>
 /// 
 /// <param name="newUnitId">newUnitId</param>
 /// <param name="newLicenseCountry">newLicenseCountry</param>
 /// <param name="newLicenseState">newLicenseState</param>
 /// <param name="newLicensePlateNumbver">newLicensePlateNumbver</param>
 /// <param name="newAportionedTagNumber">newAportionedTagNumber</param>
 /// <param name="newActualWeight">newActualWeight</param>
 /// <param name="newRegisteredWeight">newRegisteredWeight</param>
 /// <param name="newTireSizeFront">newTireSizeFront</param>
 /// <param name="newTireSizeBack">newTireSizeBack</param>
 /// <param name="newNumberOfAxes">newNumberOfAxes</param>
 /// <param name="newFuelType">newFuelType</param>
 /// <param name="newBeginningOdometer">newBeginningOdometer</param>
 /// <param name="newIsReeferEquipped">newIsReeferEquipped</param>
 /// <param name="newIsPTOEquipped">newIsPTOEquipped</param>
 /// <param name="newDeleted">newDeleted</param>
 /// <param name="newCompanyId">newCompanyId</param>
 private void UpdateUnitVehicle(int originalUnitId, Int64? originalLicenseCountry, Int64? originalLicenseState, string originalLicensePlateNumbver, string originalAportionedTagNumber, string originalActualWeight, string originalRegisteredWeight, string originalTireSizeFront, string originalTireSizeBack, string originalNumberOfAxes, string originalFuelType, string originalBeginningOdometer, bool originalIsReeferEquipped, bool originalIsPTOEquipped, bool originalDeleted, int originalCompanyId, int newUnitId, Int64? newLicenseCountry, Int64? newLicenseState, string newLicensePlateNumbver, string newAportionedTagNumber, string newActualWeight, string newRegisteredWeight, string newTireSizeFront, string newTireSizeBack, string newNumberOfAxes, string newFuelType, string newBeginningOdometer, bool newIsReeferEquipped, bool newIsPTOEquipped, bool newDeleted, int newCompanyId)
 {
     UnitsVehicle unitsVehicle = new UnitsVehicle(null);
     unitsVehicle.UpdateDirect(originalUnitId, originalLicenseCountry, originalLicenseState, originalLicensePlateNumbver, originalAportionedTagNumber, originalActualWeight, originalRegisteredWeight, originalTireSizeFront, originalTireSizeBack, originalNumberOfAxes, originalFuelType, originalBeginningOdometer, originalIsReeferEquipped, originalIsPTOEquipped, originalDeleted, originalCompanyId, newUnitId, newLicenseCountry, newLicenseState, newLicensePlateNumbver, newAportionedTagNumber, newActualWeight, newRegisteredWeight, newTireSizeFront, newTireSizeBack, newNumberOfAxes, newFuelType, newBeginningOdometer, newIsReeferEquipped, newIsPTOEquipped, newDeleted, newCompanyId);
 }