/// <summary> /// DeleteDirect /// </summary> /// <param name="workId">workId</param> /// <param name="companyId">companyId</param> public void DeleteDirect(int workId, int companyId) { WorkJunctionLiningSectionGateway workJunctionLiningSectionGateway = new WorkJunctionLiningSectionGateway(); workJunctionLiningSectionGateway.LoadByWorkId(workId, companyId); if (workJunctionLiningSectionGateway.Table.Rows.Count > 0) { WorkJunctionLiningLateralGateway workJunctionLiningLateralGateway = new WorkJunctionLiningLateralGateway(); workJunctionLiningLateralGateway.LoadBySectionWorkId(workId, companyId); // ... Delete Laterals WorkJunctionLiningLateral workJunctionLiningLateral = new WorkJunctionLiningLateral(); foreach (WorkTDS.LFS_WORK_JUNCTIONLINING_LATERALRow row in (WorkTDS.LFS_WORK_JUNCTIONLINING_LATERALDataTable)workJunctionLiningLateralGateway.Table) { workJunctionLiningLateral.DeleteDirect(row.WorkID, row.SectionWorkID, companyId); } // ... Delete WorkJunctionLiningSection workJunctionLiningSectionGateway.Delete(workId, companyId); // ... Delete work Work work = new Work(null); work.DeleteDirect(workId, companyId); } }
/// <summary> /// DeleteJLLaterals /// </summary> /// <param name="currentProjectId">currentProjectId</param> /// <param name="lateral_assetId">lateral_assetId</param> /// <param name="companyId">companyId</param> /// <param name="sectionWorkId">sectionWorkId</param> private void DeleteJLLaterals(int currentProjectId, int lateral_assetId, int companyId, int sectionWorkId) { // Load work id WorkGateway workGateway = new WorkGateway(); workGateway.LoadByProjectIdAssetIdWorkType(currentProjectId, lateral_assetId, "Junction Lining Lateral", companyId); if (workGateway.Table.Rows.Count > 0) { int workId = workGateway.GetWorkId(lateral_assetId, "Junction Lining Lateral", currentProjectId); if (workId > 0) { // Delete work WorkJunctionLiningLateral workJunctionLiningLateral = new WorkJunctionLiningLateral(null); workJunctionLiningLateral.DeleteDirect(workId, sectionWorkId, companyId); } } }
/// <summary> /// Delete /// </summary> /// <param name="workId">workId</param> /// <param name="assetIdLateral">assetIdLateral</param> /// <param name="sectionWorkId">sectionWorkId</param> /// <param name="companyId">companyId</param> private void Delete(int workId, int assetIdLateral, int sectionWorkId, int companyId) { WorkGateway workGateway = new WorkGateway(); workGateway.LoadByWorkId(workId, companyId); int currentProjectId = workGateway.GetProjectId(workId); ProjectGateway projectGateway = new ProjectGateway(); projectGateway.LoadByProjectId(currentProjectId); int clientId = projectGateway.GetClientID(currentProjectId); // delete lateral work WorkJunctionLiningLateral workJunctionLiningLateral = new WorkJunctionLiningLateral(null); workJunctionLiningLateral.DeleteDirect(workId, sectionWorkId, companyId); // delete lfs lateral LfsAssetSewerLateral lfsAssetSewerLateral = new LfsAssetSewerLateral(null); bool isDeleted = lfsAssetSewerLateral.DeleteDirect(assetIdLateral, companyId); if (isDeleted) { // delete lfs lateral client LfsAssetSewerLateralClientGateway lfsAssetSewerLateralClientGateway = new LfsAssetSewerLateralClientGateway(); lfsAssetSewerLateralClientGateway.LoadByAssetIdClientId(assetIdLateral, clientId, companyId); if (lfsAssetSewerLateralClientGateway.Table.Rows.Count > 0) { LfsAssetSewerLateralClient lfsAssetSewerLateralClient = new LfsAssetSewerLateralClient(null); lfsAssetSewerLateralClient.DeleteDirect(assetIdLateral, clientId, companyId); } } }