Пример #1
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);
            }
        }