/// <summary>
        /// Update Lateral
        /// </summary>
        /// <param name="row">row</param>
        /// <param name="projectId">projectId</param>
        /// <param name="sectionAssetId">sectionAssetId</param>
        /// <param name="countryId">countryId</param>
        /// <param name="provinceId">provinceId</param>
        /// <param name="countyId">countyId</param>
        /// <param name="cityId">cityId</param>
        /// <param name="videoLength">videoLength</param>
        /// <param name="companyId">companyId</param>
        private void UpdateLateral(FullLengthLiningTDS.LateralDetailsRow row, int projectId, int sectionAssetId, Int64 countryId, Int64? provinceId, Int64? countyId, Int64? cityId, string videoLength, int companyId)
        {
            // not modified variables
            FullLengthLiningTDS fullLengthLining = (FullLengthLiningTDS)Data;
            FullLengthLiningLateralDetailsGateway fullLengthLiningLateralDetailsGateway = new FullLengthLiningLateralDetailsGateway(fullLengthLining);
            int lateral = row.Lateral;

            AssetSewerLateralGateway assetSewerLateralGateway = new AssetSewerLateralGateway();
            assetSewerLateralGateway.LoadByAssetId(lateral, companyId);

            int section_ = assetSewerLateralGateway.GetSection(lateral);
            string address = assetSewerLateralGateway.GetAddress(lateral);
            string lateralId = assetSewerLateralGateway.GetLateralId(lateral);
            string latitudeAtSection = assetSewerLateralGateway.GetLatitudeAtSection(lateral);
            string longitudeAtSection = assetSewerLateralGateway.GetLongitudeAtSection(lateral);
            string latitudeAtPropertyLine = assetSewerLateralGateway.GetLatitudeAtPropertyLine(lateral);
            string longitudeAtPropertyLine = assetSewerLateralGateway.GetLongitudeAtPropertyLine(lateral);
            string mapSize = assetSewerLateralGateway.GetMapSize(lateral);

            // original values
            string originalState = fullLengthLiningLateralDetailsGateway.GetLiveOriginal(lateral);
            string originalSize = fullLengthLiningLateralDetailsGateway.GetSizeOriginal(lateral);
            string originalDistanceFromUsmh = fullLengthLiningLateralDetailsGateway.GetDistanceFromUSMHOriginal(lateral);
            string originalDistanceFromDsmh = fullLengthLiningLateralDetailsGateway.GetDistanceFromDSMHOriginal(lateral);
            string originalConnectionType = fullLengthLiningLateralDetailsGateway.GetConnectionTypeOriginal(lateral);
            string originalAddress = fullLengthLiningLateralDetailsGateway.GetMnOriginal(lateral);

            // new values
            string newState = fullLengthLiningLateralDetailsGateway.GetLive(lateral);
            string newSize = fullLengthLiningLateralDetailsGateway.GetSize(lateral);
            string newDistanceFromUsmh = fullLengthLiningLateralDetailsGateway.GetDistanceFromUSMH(lateral);
            string newDistanceFromDsmh = fullLengthLiningLateralDetailsGateway.GetDistanceFromDSMH(lateral);
            string newConnectionType = fullLengthLiningLateralDetailsGateway.GetConnectionType(lateral);
            string newAddress = fullLengthLiningLateralDetailsGateway.GetMn(lateral);

            // update asset laterals
            AssetSewerLateral assetSewerLateral = new AssetSewerLateral(null);
            assetSewerLateral.UpdateDirect(lateral, section_, originalAddress, lateralId, latitudeAtSection, longitudeAtSection, latitudeAtPropertyLine, longitudeAtPropertyLine, originalState, originalSize, originalDistanceFromUsmh, originalDistanceFromDsmh, mapSize, false, companyId, originalConnectionType, lateral, section_, newAddress, lateralId, latitudeAtSection, longitudeAtSection, latitudeAtPropertyLine, longitudeAtPropertyLine, newState, newSize, newDistanceFromUsmh, newDistanceFromDsmh, mapSize, false, companyId, newConnectionType);
        }
Exemplo n.º 2
0
        /// <summary>
        /// LateralUpdate
        /// </summary>
        /// <param name="currentProjectId">currentProjectId</param>
        /// <param name="assetId">assetId</param>
        /// <param name="distanceFromDsmh">distanceFromDsmh</param>
        /// <param name="distanceFromUsmh">distanceFromUsmh</param>
        /// <param name="mapSize">mapSize</param>
        /// <param name="companyId">companyId</param>
        /// <param name="clientLateralId">clientLateralId</param>
        /// <param name="address">address</param>
        /// <param name="connectionType">connectionType</param>
        private void LateralUpdate(int currentProjectId, int assetId, string distanceFromDsmh, string distanceFromUsmh, string mapSize, int companyId, string clientLateralId, string address, string connectionType)
        {
            AssetSewerLateralGateway assetSewerLateralGateway = new AssetSewerLateralGateway();
            assetSewerLateralGateway.LoadByAssetId(assetId, companyId);

            // original values
            int originalSection_ = assetSewerLateralGateway.GetSection(assetId);
            string originalAddress = assetSewerLateralGateway.GetAddress(assetId);
            string originalLateralId = assetSewerLateralGateway.GetLateralId(assetId);
            string originalLatitudeAtSection = assetSewerLateralGateway.GetLatitudeAtSection(assetId);
            string originalLongitudeAtSection = assetSewerLateralGateway.GetLongitudeAtSection(assetId);
            string originalLatitudeAtPropertyLine = assetSewerLateralGateway.GetLatitudeAtPropertyLine(assetId);
            string originalLongitudeAtPropertyLine = assetSewerLateralGateway.GetLongitudeAtPropertyLine(assetId);
            string originalState = assetSewerLateralGateway.GetState(assetId);
            string originalSize_ = assetSewerLateralGateway.GetSize(assetId);
            string originalDistanceFromUsmh = assetSewerLateralGateway.GetDistanceFromUSMH(assetId);
            string originalDistanceFromDsmh = assetSewerLateralGateway.GetDistanceFromDSMH(assetId);
            string originalMapSize = assetSewerLateralGateway.GetMapSize(assetId);
            bool originalDelete = assetSewerLateralGateway.GetDeleted(assetId);
            int originalCompanyId = assetSewerLateralGateway.GetCompanyId(assetId);
            string originalConnectionType = assetSewerLateralGateway.GetConnectionType(assetId);

            // new values
            string newAddress = address;
            string newDistanceFromUsmh = originalDistanceFromUsmh;
            string newDistanceFromDsmh = originalDistanceFromDsmh;
            string newMapSize = mapSize;
            string newConnectionType = connectionType;

            // Update Sewer lateral
            AssetSewerLateral assetSewerLateral = new AssetSewerLateral(null);
            assetSewerLateral.UpdateDirect(assetId, originalSection_, originalAddress, originalLateralId, originalLatitudeAtSection, originalLongitudeAtSection, originalLatitudeAtPropertyLine, originalLongitudeAtPropertyLine, originalState, originalSize_, originalDistanceFromUsmh, originalDistanceFromDsmh, originalMapSize, originalDelete, originalCompanyId, originalConnectionType, assetId, originalSection_, newAddress, originalLateralId, originalLatitudeAtSection, originalLongitudeAtSection, originalLatitudeAtPropertyLine, originalLongitudeAtPropertyLine, originalState, originalSize_, newDistanceFromUsmh, newDistanceFromDsmh, newMapSize, originalDelete, originalCompanyId, newConnectionType);

            ProjectGateway projectGateway = new ProjectGateway();
            projectGateway.LoadByProjectId(currentProjectId);
            int clientId = projectGateway.GetClientID(currentProjectId);

            LfsAssetSewerLateralClientGateway lfsAssetSewerLateralClientGateway = new LfsAssetSewerLateralClientGateway();
            lfsAssetSewerLateralClientGateway.LoadAllByAssetIdClientId(assetId, clientId, companyId);

            if (lfsAssetSewerLateralClientGateway.Table.Rows.Count == 0)
            {
                LfsAssetSewerLateralClient lfsAssetSewerLateralClient = new LfsAssetSewerLateralClient(null);
                lfsAssetSewerLateralClient.InsertDirect(assetId, clientId, clientLateralId, false, companyId);
            }
            else
            {
                LfsAssetSewerLateralClient lfsAssetSewerLateralClient = new LfsAssetSewerLateralClient(null);
                string originalClientLateralId = lfsAssetSewerLateralClientGateway.GetClientLateralId(assetId, clientId);
                string newClientLateralId = clientLateralId;

                lfsAssetSewerLateralClient.UpdateDirect(assetId, clientId, originalClientLateralId, false, companyId, assetId, clientId, newClientLateralId, false, companyId);
            }
        }