/// <summary>
        /// Method to return Miscellaneous Structure of type Street Light Point which is owner of Located Street Light which is getting removed.
        /// </summary>
        /// <param name="relatedFeatures">RelatedFeatures list of Located StreetLight</param>
        /// <param name="streetLightFID">Located Street Light FID</param>
        /// <returns></returns>
        private IGTKeyObject CheckForMiscellaneousStructure(IGTKeyObjects relatedFeatures, int streetLightFID)
        {
            IGTKeyObject structureFeature = null;

            try
            {
                foreach (IGTKeyObject relatedFeature in relatedFeatures)
                {
                    if (relatedFeature.FNO == 107)
                    {
                        relatedFeature.Components.GetComponent(10701).Recordset.MoveFirst();

                        if (Convert.ToString(relatedFeature.Components.GetComponent(10701).Recordset.Fields["TYPE_C"].Value) == "SP")
                        {
                            StreetLightImportUtility importUtility = new StreetLightImportUtility(m_oGTDataContext);
                            relatedFeatures = importUtility.GetRelatedFeatures(relatedFeature, 2);

                            if (relatedFeatures.Count == 1 && relatedFeatures[0].FID == streetLightFID)
                            {
                                structureFeature = relatedFeatures[0];
                            }
                        }
                    }
                }
            }
            catch
            {
                throw;
            }
            return(structureFeature);
        }
示例#2
0
        /// <summary>
        /// Process street light using Structure Id.(Structure is Yes).
        /// </summary>
        /// <param name="p_xlTable">Excel data as datatbale</param>
        /// <param name="i"></param>
        private DataRow StreetLightStructureIDSY(DataRow p_xlRow)
        {
            StreetLightImportUtility streetLightImportUtility = new StreetLightImportUtility(m_gTDataContext, true, m_gTTransactionManager, m_gTApplication);

            try
            {
                AddCuAttributes(p_xlRow, streetLightImportUtility);
                streetLightImportUtility.CreateStreetLight(Convert.ToString(p_xlRow["ONCOR STRUCTURE ID"]));

                if (string.IsNullOrEmpty(streetLightImportUtility.m_strStatus))
                {
                    p_xlRow["TRANSACTION STATUS"]  = "SUCCESS";
                    p_xlRow["TRANSACTION COMMENT"] = "";
                }
                else
                {
                    p_xlRow["TRANSACTION STATUS"]  = streetLightImportUtility.m_strStatus;
                    p_xlRow["TRANSACTION COMMENT"] = streetLightImportUtility.m_strComment;
                }
            }
            catch
            {
                throw;
            }

            return(p_xlRow);
        }
        /// <summary>
        /// Method to delete StreetLight.
        /// </summary>
        /// <param name="streetLightAttributeRS">Recordset of StreetLight Attribute</param>
        /// <param name="locatable">Bool value whether StreetLight is Located to delete</param>
        /// <returns></returns>
        private void DeleteStreetLight(Recordset streetLightAttributeRS, bool locatable)
        {
            IGTKeyObjects relatedFeatures = GTClassFactory.Create <IGTKeyObjects>();
            IGTKeyObjects deleteFeatures  = GTClassFactory.Create <IGTKeyObjects>();
            IGTKeyObject  feature         = GTClassFactory.Create <IGTKeyObject>();

            try
            {
                StreetLightImportUtility importUtility = new StreetLightImportUtility(m_oGTDataContext);

                if (!m_oGTTransactionManager.TransactionInProgress)
                {
                    m_oGTTransactionManager.Begin("Importing Street Light(s) using Import Tool");
                }

                if (locatable)
                {
                    streetLightAttributeRS.MoveFirst();

                    feature = m_oGTDataContext.OpenFeature(Convert.ToInt16(streetLightAttributeRS.Fields["G3E_FNO"].Value), Convert.ToInt32(streetLightAttributeRS.Fields["G3E_FID"].Value));
                    deleteFeatures.Add(feature);

                    relatedFeatures = importUtility.GetRelatedFeatures(feature, 3);
                    if (relatedFeatures.Count > 0)
                    {
                        feature = CheckForMiscellaneousStructure(relatedFeatures, feature.FID);

                        if (feature != null)
                        {
                            deleteFeatures.Add(feature);
                        }
                    }
                }
                else
                {
                    streetLightAttributeRS.MoveFirst();
                    while (!streetLightAttributeRS.EOF)
                    {
                        feature = m_oGTDataContext.OpenFeature(Convert.ToInt16(streetLightAttributeRS.Fields["G3E_FNO"].Value), Convert.ToInt32(streetLightAttributeRS.Fields["G3E_FID"].Value));
                        deleteFeatures.Add(feature);

                        streetLightAttributeRS.MoveNext();
                    }
                }
                importUtility.DeleteFeatures(deleteFeatures);

                if (m_oGTTransactionManager.TransactionInProgress)
                {
                    m_oGTTransactionManager.Commit(true);
                    m_oGTTransactionManager.RefreshDatabaseChanges();
                }
            }
            catch
            {
                throw;
            }
        }
示例#4
0
 /// <summary>
 /// Adding Cu Attributes to ImportUtility class object.
 /// </summary>
 /// <param name="p_xlTable">Excel data as datatbale</param>
 /// <param name="streetLightImportUtility">ImportUtility class object</param>
 /// <param name="i"></param>
 private static void AddCuAttributes(DataRow p_xlRow, StreetLightImportUtility streetLightImportUtility)
 {
     if (!string.IsNullOrEmpty(Convert.ToString(p_xlRow["LAMP TYPE"])) &&
         !string.IsNullOrEmpty(Convert.ToString(p_xlRow["WATTAGE"])) &&
         !string.IsNullOrEmpty(Convert.ToString(p_xlRow["LUMINAIRE STYLE"])))
     {
         streetLightImportUtility.m_strLampType  = Convert.ToString(p_xlRow["LAMP TYPE"]);
         streetLightImportUtility.m_strLumiStyle = Convert.ToString(p_xlRow["LUMINAIRE STYLE"]);
         streetLightImportUtility.m_strWattage   = Convert.ToString(p_xlRow["WATTAGE"]);
     }
 }
示例#5
0
        /// <summary>
        /// Process street light using GPS Coordinates(Structure is Yes).
        /// </summary>
        /// <param name="p_xlTable">Excel data as datatbale</param>
        /// <param name="i"></param>
        private DataRow StreetLightESILocationSY(DataRow p_xlRow)
        {
            StreetLightImportUtility streetLightImportUtility = new StreetLightImportUtility(m_gTDataContext, false, m_gTTransactionManager, m_gTApplication);

            try
            {
                if (!string.IsNullOrEmpty(Convert.ToString(p_xlRow["LAMP TYPE"])) &&
                    !string.IsNullOrEmpty(Convert.ToString(p_xlRow["WATTAGE"])) &&
                    !string.IsNullOrEmpty(Convert.ToString(p_xlRow["LUMINAIRE STYLE"])))
                {
                    streetLightImportUtility.m_strLampType  = Convert.ToString(p_xlRow["LAMP TYPE"]);
                    streetLightImportUtility.m_strLumiStyle = Convert.ToString(p_xlRow["LUMINAIRE STYLE"]);
                    streetLightImportUtility.m_strWattage   = Convert.ToString(p_xlRow["WATTAGE"]);
                }
                int MiscellaneousStructureFID = streetLightImportUtility.GetMiscStructureFID(Convert.ToString(p_xlRow["ESI LOCATION"]));

                if (MiscellaneousStructureFID != 0)
                {
                    streetLightImportUtility.CreateStreetLightWithAccountStructure(MiscellaneousStructureFID);
                    if (string.IsNullOrEmpty(streetLightImportUtility.m_strStatus))
                    {
                        p_xlRow["TRANSACTION STATUS"]  = "WARNING";
                        p_xlRow["TRANSACTION COMMENT"] = "Structure ID not found and no GPS given.  Placed non-located Street Light at location of account’s structure.";
                    }
                    else
                    {
                        p_xlRow["TRANSACTION STATUS"]  = streetLightImportUtility.m_strStatus;
                        p_xlRow["TRANSACTION COMMENT"] = streetLightImportUtility.m_strComment;
                    }
                }
                else
                {
                    streetLightImportUtility.CreateStreetLightWithAccountBoundary(Convert.ToString(p_xlRow["ESI LOCATION"]));

                    if (string.IsNullOrEmpty(streetLightImportUtility.m_strStatus))
                    {
                        p_xlRow["TRANSACTION STATUS"]  = "WARNING";
                        p_xlRow["TRANSACTION COMMENT"] = "Structure ID not found and no GPS.  Placed non-located Street Light at centroid of account boundary.";
                    }
                    else
                    {
                        p_xlRow["TRANSACTION STATUS"]  = streetLightImportUtility.m_strStatus;
                        p_xlRow["TRANSACTION COMMENT"] = streetLightImportUtility.m_strComment;
                    }
                }
            }
            catch
            {
                throw;
            }
            return(p_xlRow);
        }
示例#6
0
        /// <summary>
        /// Process street light using ESI Location(Structure is No).
        /// </summary>
        /// <param name="p_xlTable">Excel data as datatbale</param>
        /// <param name="streetLightImportUtility">ImportUtility class object</param>
        /// <param name="i"></param>
        private DataRow StreetLightESILocationSN(DataRow p_xlRow, StreetLightImportUtility streetLightImportUtility)
        {
            try
            {
                AddCuAttributes(p_xlRow, streetLightImportUtility);
                int MiscellaneousStructureFID = streetLightImportUtility.GetMiscStructureFID(Convert.ToString(p_xlRow["ESI LOCATION"]));

                if (MiscellaneousStructureFID != 0)
                {
                    streetLightImportUtility.CreateStreetLightWithAccountStructure(MiscellaneousStructureFID);
                    if (string.IsNullOrEmpty(streetLightImportUtility.m_strStatus))
                    {
                        p_xlRow["TRANSACTION STATUS"]  = "WARNING";
                        p_xlRow["TRANSACTION COMMENT"] = "No Structure or GPS given.  Placed non-located Street Light at location of account’s structure.";
                    }
                    else
                    {
                        p_xlRow["TRANSACTION STATUS"]  = streetLightImportUtility.m_strStatus;
                        p_xlRow["TRANSACTION COMMENT"] = streetLightImportUtility.m_strComment;
                    }
                }
                else
                {
                    streetLightImportUtility.CreateStreetLightWithAccountBoundary(Convert.ToString(p_xlRow["ESI LOCATION"]));
                    if (string.IsNullOrEmpty(streetLightImportUtility.m_strStatus))
                    {
                        p_xlRow["TRANSACTION STATUS"]  = "WARNING";
                        p_xlRow["TRANSACTION COMMENT"] = "No Structure or GPS given.  Placed non-located Street Light at centroid of account boundary.";
                    }
                    else
                    {
                        p_xlRow["TRANSACTION STATUS"]  = streetLightImportUtility.m_strStatus;
                        p_xlRow["TRANSACTION COMMENT"] = streetLightImportUtility.m_strComment;
                    }
                }
            }
            catch
            {
                throw;
            }

            return(p_xlRow);
        }
示例#7
0
        /// <summary>
        /// Process street light using GPS Coordinates(Structure is No).
        /// </summary>
        /// <param name="p_xlTable">Excel data as datatbale</param>
        /// <param name="i"></param>
        private DataRow StreetLightGPSSN(DataRow p_xlRow)
        {
            StreetLightImportUtility streetLightImportUtility = new StreetLightImportUtility(m_gTDataContext, true, m_gTTransactionManager, m_gTApplication);

            try
            {
                AddCuAttributes(p_xlRow, streetLightImportUtility);

                string gpsx  = Regex.Replace(Convert.ToString(p_xlRow["GPS X"]), "[A-Za-z ]", "");
                double gpsdx = double.Parse(gpsx.Trim());

                string gpsy  = Regex.Replace(Convert.ToString(p_xlRow["GPS Y"]), "[A-Za-z ]", "");
                double gpsdy = double.Parse(gpsy.Trim());

                double dZoord = 0.0;

                ConvertToLatitudeAndLongitude(ref gpsdx, ref gpsdy, ref dZoord);

                streetLightImportUtility.CreateStreetLight(gpsdx, gpsdy);


                if (string.IsNullOrEmpty(streetLightImportUtility.m_strStatus))
                {
                    p_xlRow["TRANSACTION STATUS"]  = "SUCCESS";
                    p_xlRow["TRANSACTION COMMENT"] = "";
                }
                else
                {
                    p_xlRow["TRANSACTION STATUS"]  = streetLightImportUtility.m_strStatus;
                    p_xlRow["TRANSACTION COMMENT"] = streetLightImportUtility.m_strComment;
                }
            }
            catch
            {
                throw;
            }

            return(p_xlRow);
        }
示例#8
0
        /// <summary>
        /// Create streetlights based on table data.
        /// </summary>
        /// <param name="p_xlTable">Excel sheet as Datatable</param>
        /// <returns></returns>
        public DataRow AddStreetLightForTranstionTypeAdd(DataRow p_xlRow)
        {
            StreetLightImportUtility streetLightImportUtility = null;

            try
            {
                if (Convert.ToString(p_xlRow["TRANSACTION TYPE"]).ToUpper() == "ADD")
                {
                    if (p_xlRow["TRANSACTION STATUS"] == null ||
                        (Convert.ToString(p_xlRow["TRANSACTION STATUS"]).ToUpper() != "SUCCESS" &&
                         Convert.ToString(p_xlRow["TRANSACTION STATUS"]).ToUpper() != "WARNING"))
                    {
                        if (Convert.ToString(p_xlRow["ONCOR STRUCTURE"]).ToUpper() == "Y")
                        {
                            if (!string.IsNullOrEmpty(Convert.ToString(p_xlRow["ONCOR STRUCTURE ID"])))
                            {
                                p_xlRow = StreetLightStructureIDSY(p_xlRow);
                            }
                            else if (p_xlRow["GPS X"] != null && p_xlRow["GPS Y"] != null &&
                                     (!string.IsNullOrEmpty(Convert.ToString(p_xlRow["GPS X"]))) &&
                                     (!string.IsNullOrEmpty(Convert.ToString(p_xlRow["GPS Y"]))))
                            {
                                p_xlRow = StreetLightGPSSY(p_xlRow);
                            }
                            else if (!string.IsNullOrEmpty(Convert.ToString(p_xlRow["ESI LOCATION"])))
                            {
                                p_xlRow = StreetLightESILocationSY(p_xlRow);
                            }
                        }
                        else if (Convert.ToString(p_xlRow["ONCOR STRUCTURE"]).ToUpper() == "N")
                        {
                            if (p_xlRow["GPS X"] != null && p_xlRow["GPS Y"] != null &&
                                (!string.IsNullOrEmpty(Convert.ToString(p_xlRow["GPS X"]))) &&
                                (!string.IsNullOrEmpty(Convert.ToString(p_xlRow["GPS Y"]))))
                            {
                                p_xlRow = StreetLightGPSSN(p_xlRow);
                            }
                            else if (!string.IsNullOrEmpty(Convert.ToString(p_xlRow["ESI LOCATION"])))
                            {
                                streetLightImportUtility = new StreetLightImportUtility(m_gTDataContext, false, m_gTTransactionManager, m_gTApplication);
                                p_xlRow = StreetLightESILocationSN(p_xlRow, streetLightImportUtility);
                            }
                        }

                        if (Convert.ToString(p_xlRow["TRANSACTION STATUS"]) == "SUCCESS")
                        {
                            m_nbrSuccess++;
                        }
                        else if (Convert.ToString(p_xlRow["TRANSACTION STATUS"]) == "ERROR")
                        {
                            m_nbrError++;
                        }
                        else if (Convert.ToString(p_xlRow["TRANSACTION STATUS"]) == "WARNING")
                        {
                            m_nbrWarning++;
                        }

                        p_xlRow["TRANSACTION DATE"] = DateTime.Today;
                    }
                }
            }
            catch
            {
                throw;
            }

            return(p_xlRow);
        }