Ejemplo n.º 1
0
        public Dictionary <IGTKeyObject, IGTComponents> GetComponentsChangedCollection(IGTKeyObjects p_KeyObjects)
        {
            Dictionary <IGTKeyObject, IGTComponents> dicReturn = new Dictionary <IGTKeyObject, IGTComponents>();
            IGTComponents gTCUComponents = GTClassFactory.Create <IGTComponents>();

            try
            {
                foreach (IGTKeyObject oKeyObject in p_KeyObjects)
                {
                    if (oKeyObject.Components.GetComponent(21) != null)
                    {
                        gTCUComponents.Add(oKeyObject.Components.GetComponent(21));
                    }

                    if (oKeyObject.Components.GetComponent(22) != null)
                    {
                        gTCUComponents.Add(oKeyObject.Components.GetComponent(22));
                    }
                    IGTComponents oCompCollection = SetComponentsChanged(gTCUComponents);
                    if (oCompCollection.Count > 0)
                    {
                        dicReturn.Add(oKeyObject, oCompCollection);
                    }
                }
            }
            catch
            {
                throw;
            }
            return(dicReturn);
        }
Ejemplo n.º 2
0
        private void ProcessWPSync(IGTDDCKeyObject selectedObject)
        {
            try
            {
                WorkPointOperations oWorkPointOperations = null;
                IGTComponents       gTComponents         = GTClassFactory.Create <IGTComponents>();
                IGTKeyObject        feature       = m_iGtApplication.DataContext.OpenFeature(selectedObject.FNO, selectedObject.FID);
                Recordset           cuComponentRs = feature.Components.GetComponent(21).Recordset;
                if (cuComponentRs != null && cuComponentRs.RecordCount > 0)
                {
                    gTComponents.Add(feature.Components.GetComponent(21));
                }
                // Set Activity in Ancillary CU attributes
                if (feature.Components.GetComponent(22) != null)
                {
                    Recordset acuComponentRs = feature.Components.GetComponent(22).Recordset;
                    if (acuComponentRs != null && acuComponentRs.RecordCount > 0)
                    {
                        gTComponents.Add(feature.Components.GetComponent(22));
                    }
                }

                // Synchronize the workpoint
                oWorkPointOperations = new WorkPointOperations(gTComponents, feature, m_DataContext);
                oWorkPointOperations.DoWorkpointOperations();
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Method to set the activity attribute of the CU and ACU components
        /// </summary>
        /// <param name="selectedObject">Selected feature on map window</param>
        private void SetActivity(IGTDDCKeyObject selectedObject)
        {
            Recordset           cuComponentRs        = null;
            Recordset           acuComponentRs       = null;
            WorkPointOperations oWorkPointOperations = null;
            IGTComponents       gTComponents         = GTClassFactory.Create <IGTComponents>();

            try
            {
                IGTKeyObject feature = m_iGtApplication.DataContext.OpenFeature(selectedObject.FNO, selectedObject.FID);
                // Set Activity in CU attributes
                cuComponentRs = feature.Components.GetComponent(21).Recordset;
                if (cuComponentRs != null && cuComponentRs.RecordCount > 0)
                {
                    gTComponents.Add(feature.Components.GetComponent(21));
                    cuComponentRs.MoveFirst();
                    while (!cuComponentRs.EOF)
                    {
                        cuComponentRs.Fields["ACTIVITY_C"].Value = "A";
                        cuComponentRs.MoveNext();
                    }
                }
                // Set Activity in Ancillary CU attributes
                if (feature.Components.GetComponent(22) != null)
                {
                    acuComponentRs = feature.Components.GetComponent(22).Recordset;
                    if (acuComponentRs != null && acuComponentRs.RecordCount > 0)
                    {
                        gTComponents.Add(feature.Components.GetComponent(22));
                        acuComponentRs.MoveFirst();
                        while (!acuComponentRs.EOF)
                        {
                            string retiremenType = Convert.ToString(acuComponentRs.Fields["RETIREMENT_C"].Value);
                            if (retiremenType == "1" || retiremenType == "2")
                            {
                                acuComponentRs.Fields["ACTIVITY_C"].Value = "R";
                            }
                            acuComponentRs.MoveNext();
                        }
                    }
                }

                //// Synchronize the workpoint
                //oWorkPointOperations = new WorkPointOperations(gTComponents, feature, m_DataContext);
                //oWorkPointOperations.DoWorkpointOperations();
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 4
0
        private void SynchronizeWP(IGTKeyObject p_KeyObjectFeature)
        {
            try
            {
                m_oGTTransactionManager.Begin("Synchronize WorkPoints for Repeat Reconductoring Feature =" + p_KeyObjectFeature.FNO.ToString() + " FID = " + p_KeyObjectFeature.FID.ToString());

                IGTComponents CUComponentsOldFeature = GTClassFactory.Create <IGTComponents>();

                foreach (IGTComponent item in p_KeyObjectFeature.Components)
                {
                    if (item.CNO == 21 || item.CNO == 22)
                    {
                        CUComponentsOldFeature.Add(item);
                    }
                }
                WorkPointOperations obj = new WorkPointOperations(CUComponentsOldFeature, p_KeyObjectFeature, m_iGtApplication.DataContext);
                obj.DoWorkpointOperations();

                m_oGTTransactionManager.Commit();
                m_oGTTransactionManager.RefreshDatabaseChanges();
            }
            catch (Exception ex)
            {
                if (m_oGTTransactionManager.TransactionInProgress)
                {
                    m_oGTTransactionManager.Rollback();
                }
                throw ex;
            }
        }
Ejemplo n.º 5
0
        public void SetComponentsChanged(IGTComponents gTChangedComponents)
        {
            Recordset rs = null;

            try
            {
                foreach (IGTComponent gtComp in gTChangedComponents)
                {
                    rs = gtComp.Recordset;
                    if (rs != null && rs.RecordCount > 0)
                    {
                        rs.MoveFirst();
                        while (!rs.EOF)
                        {
                            foreach (Field field in rs.Fields)
                            {
                                if (field.OriginalValue.ToString() != field.Value.ToString())
                                {
                                    if (!m_gtAllCUComponents.Contains(gtComp))//Added by Prathyusha
                                    {
                                        m_gtAllCUComponents.Add(gtComp);
                                    }
                                    break;
                                }
                            }
                            rs.MoveNext();
                        }
                    }
                }
            }
            catch
            {
                throw;
            }
        }
Ejemplo n.º 6
0
        private void SynchronizeWP()
        {
            try
            {
                foreach (IGTDDCKeyObject ddcObject in m_selectedObjects)
                {
                    m_oGTTransactionManager.Begin("Process Synchronize WorkPoints for Copy Ancillary =" + ddcObject.FNO.ToString() + " FID = " + ddcObject.FID.ToString());

                    IGTKeyObject feature = m_dataContext.OpenFeature(ddcObject.FNO, ddcObject.FID);

                    IGTComponents CUComponentsFeature = GTClassFactory.Create <IGTComponents>();

                    foreach (IGTComponent item in feature.Components)
                    {
                        if (item.CNO == 22)
                        {
                            CUComponentsFeature.Add(item);
                        }
                    }
                    WorkPointOperations obj = new WorkPointOperations(CUComponentsFeature, feature, m_dataContext);
                    obj.DoWorkpointOperations();

                    m_oGTTransactionManager.Commit();
                    m_oGTTransactionManager.RefreshDatabaseChanges();
                }
            }
            catch
            {
                throw;
            }
        }
Ejemplo n.º 7
0
        public void SynchronizeWP(IGTKeyObject p_keyObject)
        {
            IGTComponents CUComponentsNewFeature = GTClassFactory.Create <IGTComponents>();

            foreach (IGTComponent item in p_keyObject.Components)
            {
                if (item.CNO == 21 || item.CNO == 22)
                {
                    CUComponentsNewFeature.Add(item);
                }
            }
            WorkPointOperations obj = new WorkPointOperations(CUComponentsNewFeature, p_keyObject, m_dataContext);

            obj.DoWorkpointOperations();
        }
Ejemplo n.º 8
0
 private void GetAllCUComponents(IGTKeyObject feature, ref IGTComponents allCUComponents)
 {
     try
     {
         foreach (IGTComponent component in feature.Components)
         {
             if (component.CNO == 21 || component.CNO == 22)
             {
                 if (component != null)
                 {
                     if (component.Recordset != null && component.Recordset.RecordCount > 0)
                     {
                         allCUComponents.Add(component);
                     }
                 }
             }
         }
     }
     catch
     {
         throw;
     }
 }
Ejemplo n.º 9
0
        public IGTComponents GetEditedCUComponents(IGTKeyObject p_KeyObject, ADODB.Recordset p_RecordSet)
        {
            IGTComponents             oEditedComponentCollection = GTClassFactory.Create <IGTComponents>();
            Dictionary <Int32, Int16> oDic = new Dictionary <Int32, Int16>();
            bool   bPrimaryGeoemtryEdited  = false;
            bool   bCommonComponentEdited  = false;
            string sStrcurure_ID           = string.Empty;
            bool   bAncillaryEdited        = false;
            bool   bPrimaryCUEdited        = false;

            try
            {
                if (p_RecordSet != null)
                {
                    if (p_RecordSet.RecordCount > 0)
                    {
                        p_RecordSet.MoveFirst();
                        while (p_RecordSet.EOF == false)
                        {
                            int   FID = Convert.ToInt32(p_RecordSet.Fields["g3e_fid"].Value);
                            Int16 FNO = Convert.ToInt16(p_RecordSet.Fields["g3e_fno"].Value);
                            int   CNO = Convert.ToInt32(p_RecordSet.Fields["g3e_cno"].Value);

                            if (CNO == 22)
                            {
                                oEditedComponentCollection.Add(p_KeyObject.Components.GetComponent(22));
                                bAncillaryEdited = true;
                            }
                            if (CNO == 21)
                            {
                                oEditedComponentCollection.Add(p_KeyObject.Components.GetComponent(21));
                                bPrimaryCUEdited = true;
                            }
                            if (CNO == 1)
                            {
                                bCommonComponentEdited = true;
                                p_KeyObject.Components.GetComponent(1).Recordset.MoveFirst();
                                sStrcurure_ID = Convert.ToString(p_KeyObject.Components.GetComponent(1).Recordset.Fields["STRUCTURE_ID"].Value);
                            }
                            if (CNO.Equals(IsPrimaryGraphic(FNO)))
                            {
                                bPrimaryGeoemtryEdited = true;
                            }
                            p_RecordSet.MoveNext();
                        }
                        if (bCommonComponentEdited && bPrimaryGeoemtryEdited && IsWPExist(sStrcurure_ID))
                        {
                            if (p_KeyObject.Components.GetComponent(22) != null)
                            {
                                if (!bAncillaryEdited)
                                {
                                    oEditedComponentCollection.Add(p_KeyObject.Components.GetComponent(22));
                                }
                            }
                            if (p_KeyObject.Components.GetComponent(21) != null)
                            {
                                if (!bPrimaryCUEdited)
                                {
                                    oEditedComponentCollection.Add(p_KeyObject.Components.GetComponent(21));
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                string exMsg = string.Format("Error occurred in {0} of {1}.{2}{3}", System.Reflection.MethodBase.GetCurrentMethod().Name, this.ToString(), Environment.NewLine, ex.Message);
                throw new Exception(exMsg);
            }

            return(oEditedComponentCollection);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// RevertFeture : Removes CUs for a feature that has been posted as part of a WR.
        /// </summary>
        /// <param name="fno"></param>
        /// <param name="fid"></param>
        /// <param name="strFState"></param>
        /// <param name="isfromWP"></param>
        /// <param name="wpFno"></param>
        /// <param name="wpFid"></param>
        public void RevertFeture(short fno, int fid, string strFState, short isfromWP, short wpFno, int wpFid)
        {
            IGTComponent  cuComponent  = null;
            IGTComponent  acuComponent = null;
            IGTComponents cComponents  = GTClassFactory.Create <IGTComponents>();
            IGTKeyObject  actKeyObj    = null;
            IGTKeyObject  actWPKeyObj  = null;
            //bool cWRid = false;
            bool deleteFt = false;
            bool unCu     = false;

            try
            {
                actKeyObj = m_gtApplication.DataContext.OpenFeature(fno, fid);

                cuComponent  = actKeyObj.Components.GetComponent(21);
                acuComponent = actKeyObj.Components.GetComponent(22);
                cComponents.Add(cuComponent);
                cComponents.Add(acuComponent);

                if (isfromWP == 1)
                {
                    if (actKeyObj.Components["COMMON_N"].Recordset != null && actKeyObj.Components["COMMON_N"].Recordset.RecordCount > 0)
                    {
                        actKeyObj.Components["COMMON_N"].Recordset.MoveFirst();
                        strFState = actKeyObj.Components["COMMON_N"].Recordset.Fields["FEATURE_STATE_C"].Value.ToString();
                    }

                    actWPKeyObj = m_gtApplication.DataContext.OpenFeature(wpFno, wpFid);
                }


                bool bActivity  = true;
                bool bWRMatches = true;

                #region Case when feature state = INI and all CU and Ancillary CU components have activity I or IC
                foreach (IGTComponent comp in cComponents)
                {
                    if (strFState == "INI")
                    {
                        if (comp != null && comp.Recordset != null && comp.Recordset.RecordCount > 0)
                        {
                            comp.Recordset.MoveFirst();

                            while (!comp.Recordset.EOF)
                            {
                                if (comp.Recordset.Fields["WR_ID"].Value.ToString() != m_gtApplication.DataContext.ActiveJob)
                                {
                                    bWRMatches = false;
                                    break;
                                }
                                if (comp.Recordset.Fields["ACTIVITY_C"].Value.ToString() != "I" && comp.Recordset.Fields["ACTIVITY_C"].Value.ToString() != "IC")
                                {
                                    bActivity = false;
                                    break;
                                }

                                comp.Recordset.MoveNext();
                            }
                        }
                    }
                }
                if (strFState == "INI" && bActivity && bWRMatches)
                {
                    DeleteFeature(actKeyObj);
                    return;
                }
                #endregion


                foreach (IGTComponent comp in cComponents)
                {
                    //cWRid = false;
                    if (strFState == "PPI" || strFState == "ABI")
                    {
                        #region

                        if (comp != null && comp.Recordset != null && comp.Recordset.RecordCount > 0)
                        {
                            comp.Recordset.MoveFirst();
                            while (!comp.Recordset.EOF)
                            {
                                if (comp.Recordset.Fields["WR_ID"].Value.ToString() == m_gtApplication.DataContext.ActiveJob)
                                {
                                    //cWRid = true;
                                    deleteFt = true;
                                    if (isfromWP == 1)
                                    {
                                        DeleteWorkPointCU(actKeyObj, actWPKeyObj, comp);
                                    }
                                }
                                else
                                {
                                    unCu = true;
                                }
                                comp.Recordset.MoveNext();
                            }
                        }

                        #endregion
                    }
                    else if (strFState == "PPR" || strFState == "ABR" || strFState == "PPA" || strFState == "ABA")
                    {
                        #region

                        if (comp != null && comp.Recordset != null && comp.Recordset.RecordCount > 0)
                        {
                            comp.Recordset.MoveFirst();
                            while (!comp.Recordset.EOF)
                            {
                                if (comp.Recordset.Fields["WR_ID"].Value.ToString() == m_gtApplication.DataContext.ActiveJob ||
                                    Convert.ToString(comp.Recordset.Fields["WR_EDITED"].Value) == m_gtApplication.DataContext.ActiveJob)
                                {
                                    if (isfromWP == 1)
                                    {
                                        DeleteWorkPointCU(actKeyObj, actWPKeyObj, comp);
                                    }

                                    comp.Recordset.Fields["ACTIVITY_C"].Value = "";
                                    comp.Recordset.Update();
                                    //cWRid = true;

                                    if (actKeyObj.Components["COMMON_N"] != null && actKeyObj.Components["COMMON_N"].Recordset != null && actKeyObj.Components["COMMON_N"].Recordset.RecordCount > 0)
                                    {
                                        actKeyObj.Components["COMMON_N"].Recordset.Fields["FEATURE_STATE_C"].Value = "CLS";
                                        actKeyObj.Components["COMMON_N"].Recordset.Update();
                                    }
                                }
                                else
                                {
                                    unCu = true;
                                }
                                comp.Recordset.MoveNext();
                            }
                        }


                        #endregion
                    }
                    else if (strFState == "PPX" || strFState == "ABX" || strFState == "INI")
                    {
                        #region

                        if (comp != null && comp.Recordset != null && comp.Recordset.RecordCount > 0)
                        {
                            comp.Recordset.MoveFirst();
                            while (!comp.Recordset.EOF)
                            {
                                if (comp.Recordset.Fields["WR_ID"].Value.ToString() == m_gtApplication.DataContext.ActiveJob)
                                {
                                    //cWRid = true;


                                    if (actKeyObj.Components["COMMON_N"] != null && actKeyObj.Components["COMMON_N"].Recordset != null && actKeyObj.Components["COMMON_N"].Recordset.RecordCount > 0)
                                    {
                                        actKeyObj.Components["COMMON_N"].Recordset.Fields["FEATURE_STATE_C"].Value = "CLS";
                                        actKeyObj.Components["COMMON_N"].Recordset.Update();
                                    }

                                    if (isfromWP == 1)
                                    {
                                        DeleteWorkPointCU(actKeyObj, actWPKeyObj, comp);
                                    }

                                    if (Convert.ToString(comp.Recordset.Fields["ACTIVITY_C"].Value) != "")
                                    {
                                        if (comp.Recordset.Fields["ACTIVITY_C"].Value.ToString() == "I" || comp.Recordset.Fields["ACTIVITY_C"].Value.ToString() == "IC")
                                        {
                                            comp.Recordset.Delete();
                                        }
                                        else if (comp.Recordset.Fields["ACTIVITY_C"].Value.ToString() == "R" || comp.Recordset.Fields["ACTIVITY_C"].Value.ToString() == "RC")
                                        {
                                            comp.Recordset.Fields["ACTIVITY_C"].Value = "";
                                            comp.Recordset.Update();
                                        }
                                    }
                                }
                                else
                                {
                                    unCu = true;
                                }
                                comp.Recordset.MoveNext();
                            }
                        }

                        #endregion
                    }
                    else
                    {
                        m_uProcessedCUs = true;
                    }
                }

                if (deleteFt && (strFState == "PPI" || strFState == "ABI"))
                {
                    DeleteFeature(actKeyObj);
                }

                if (actWPKeyObj != null)
                {
                    DeleteFeature(actWPKeyObj);
                }

                if (unCu && !deleteFt)
                {
                    m_uProcessedCUs = true;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }