// //////////////////////////////////////////////////////////////////////// // PUBLIC METHODS // /// <summary> /// Delete /// </summary> /// <param name="workId">workId</param> /// <param name="companyId">companyId</param> public void Delete(int workId, int companyId) { WorkFullLengthLiningM1LateralGateway workFullLengthLiningM1LateralGateway = new WorkFullLengthLiningM1LateralGateway(); workFullLengthLiningM1LateralGateway.LoadByWorkId(workId, companyId); foreach (WorkTDS.LFS_WORK_FULLLENGTHLINING_M1_LATERALRow row in (WorkTDS.LFS_WORK_FULLLENGTHLINING_M1_LATERALDataTable)workFullLengthLiningM1LateralGateway.Table) { // delete lfs lateral client 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); LfsAssetSewerLateralClientGateway lfsAssetSewerLateralClientGateway = new LfsAssetSewerLateralClientGateway(); lfsAssetSewerLateralClientGateway.LoadByAssetIdClientId(row.Lateral, clientId, companyId); if (lfsAssetSewerLateralClientGateway.Table.Rows.Count > 0) { LfsAssetSewerLateralClient lfsAssetSewerLateralClient = new LfsAssetSewerLateralClient(null); lfsAssetSewerLateralClient.DeleteDirect(row.Lateral, clientId, companyId); } // Delete work lateral workFullLengthLiningM1LateralGateway.Delete(workId, row.Lateral, companyId); // Delete section LfsAssetSewerLateral lfsAssetSewerLateral = new LfsAssetSewerLateral(null); lfsAssetSewerLateral.DeleteDirect(row.Lateral, 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); } } }