Пример #1
0
        /// <summary>
        /// Get Geographic Street Light Accounts info touching boudaries
        /// </summary>
        /// <param name="g3eFid"></param>
        /// <returns></returns>
        private IList <StreetLightAccount> GetGeographicStreetLightAct(int g3eFid)
        {
            IList <StreetLightAccount>  streetLightAccts = new List <StreetLightAccount>();
            IList <StreetLightBoundary> stltBoundarys    = new List <StreetLightBoundary>();
            Recordset rs = null;

            string sqlStmt = "SELECT A.ESI_LOCATION,	D.DESCRIPTION,	A.RATE_SCHEDULE,A.LAMP_TYPE,A.WATTAGE,A.LUMINARE_STYLE FROM "+
                             " STLT_ACCOUNT A, STLT_BOUNDARY B,{0} C,STLT_DESC_VL D  WHERE A.DESCRIPTION_ID=D.DESCRIPTION_ID AND A.BOUNDARY_CLASS = B.BND_CLASS " +
                             "  AND B.BND_FNO={1} AND A.BOUNDARY_ID =TO_CHAR(c.{2}) AND c.G3E_FID={3} " +
                             " AND A.LAMP_TYPE = '{4}' AND A.WATTAGE ='{5}'" +
                             " AND A.LUMINARE_STYLE ='{6}' ";

            //check role granted user otherwise add condinition restricted ='n' to query
            if (!_gtDataContext.IsRoleGranted(StreetLightRole))
            {
                sqlStmt += "AND A.RESTRICTED = 'N'"; //(included only for non-SLAs)
            }
            //Get boundary info touching Street Light
            stltBoundarys = GetStreetLightBoundarys();
            if (stltBoundarys != null && stltBoundarys.Count > 0)
            {
                short[] boundaryFnos = stltBoundarys.Select(a => a.BoundaryFno).ToArray();

                var boundarys = GetBoundaryTouchStreetLight(boundaryFnos);
                if (boundarys.Count > 0)
                {
                    var bndFids = (from a in stltBoundarys
                                   join b in boundarys on a.BoundaryFno equals b.Value
                                   select new
                    {
                        g3eFno = b.Value,
                        g3eFid = b.Key,
                        g3eTable = a.G3eTable,
                        g3eField = a.G3eField
                    }).ToList();
                    foreach (var boundary in bndFids)
                    {
                        //Get Street Light Account
                        rs = Execute(string.Format(sqlStmt, boundary.g3eTable, boundary.g3eFno, boundary.g3eField, boundary.g3eFid, _lampType, _wattage, _lmStyle));
                        if (rs != null && rs.RecordCount > 0)
                        {
                            ConvertRsToEntity(rs).ToList().ForEach(a => streetLightAccts.Add(a));
                        }
                    }
                }
            }
            return(streetLightAccts);
        }
Пример #2
0
 private bool CheckPermissions(string authorizedRole, List <string> authorizedWrList)
 {
     try
     {
         //Prathyusha: Modified the condition from && to || as per document.
         if (m_iGtDataContext.IsRoleGranted(authorizedRole) || authorizedWrList.Contains(m_iGtDataContext.ActiveJob))
         {
             return(true);
         }
         return(false);
     }
     catch (Exception)
     {
         throw;
     }
 }
Пример #3
0
        public bool ValidateFI()
        {
            bool      validate  = false;
            Recordset jobRs     = null;
            string    strWRType = null;

            try
            {
                if (m_oGTDataContext.IsRoleGranted("PRIV_DESIGN_NET"))
                {
                    DataAccessLayer dataAccessLayer = new DataAccessLayer(m_oGTDataContext);
                    jobRs = dataAccessLayer.GetRecordset("SELECT WR_TYPE_C FROM G3E_JOB WHERE G3E_IDENTIFIER=:1", m_oGTDataContext.ActiveJob);
                    if (jobRs != null && jobRs.RecordCount > 0)
                    {
                        jobRs.MoveFirst();
                        strWRType = Convert.ToString(jobRs.Fields["WR_TYPE_C"].Value);
                        if (!string.IsNullOrEmpty(strWRType) && strWRType.ToUpper() == "NET")
                        {
                            validate = true;
                        }
                    }
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                if (jobRs != null)
                {
                    jobRs.Close();
                    jobRs = null;
                }
            }
            return(validate);
        }
Пример #4
0
        public void Validate(out string[] ErrorPriorityArray, out string[] ErrorMessageArray)
        {
            ErrorPriorityArray = new string[1];
            ErrorMessageArray  = new string[1];
            string networkManaged         = null;
            string networkRestricted      = null;
            string errorPriorityManaged   = Convert.ToString(Arguments.GetArgument(0));
            string errorPriorityUnmanaged = Convert.ToString(Arguments.GetArgument(1));
            short  m_ManholeCNO           = 10601;

            GTValidationLogger gTValidationLogger = null;

            int activeFID  = 0;
            int relatedFID = 0;

            string activeFieldValue  = string.Empty;
            string relatedFieldValue = string.Empty;

            IGTComponent activeComponent = ActiveComponents[ActiveComponentName];

            if (activeComponent != null && activeComponent.Recordset != null && activeComponent.Recordset.RecordCount > 0)
            {
                activeFID        = int.Parse(activeComponent.Recordset.Fields["G3E_FID"].Value.ToString());
                activeFieldValue = Convert.ToString(activeComponent.Recordset.Fields[ActiveFieldName].Value);
            }

            IGTComponent relatedComponent = RelatedComponents[RelatedComponentName];

            if (relatedComponent != null && relatedComponent.Recordset != null && relatedComponent.Recordset.RecordCount > 0)
            {
                relatedFID        = int.Parse(relatedComponent.Recordset.Fields["G3E_FID"].Value.ToString());
                relatedFieldValue = Convert.ToString(relatedComponent.Recordset.Fields[RelatedFieldName].Value);
            }

            if (new gtLogHelper().CheckIfLoggingIsEnabled())
            {
                LogEntries logEntries = new LogEntries
                {
                    ActiveComponentName = ActiveComponentName,
                    ActiveFID           = activeFID,
                    ActiveFieldName     = ActiveFieldName,
                    ActiveFieldValue    = activeFieldValue,
                    JobID = DataContext.ActiveJob,
                    RelatedComponentName    = RelatedComponentName,
                    RelatedFID              = relatedFID,
                    RelatedFieldName        = RelatedFieldName,
                    RelatedFieldValue       = relatedFieldValue,
                    ValidationInterfaceName = "Network Management",
                    ValidationInterfaceType = "RAI",
                };
                gTValidationLogger = new GTValidationLogger(logEntries);

                gTValidationLogger.LogEntry("TIMING", "START", "Network Management Entry", "N/A", "");
            }

            try
            {
                ValidationRuleManager validateMsg = new ValidationRuleManager();

                IGTApplication gtApplication = GTClassFactory.Create <IGTApplication>();
                gtApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Network Management Validation Started");

                if (m_oRelatedComponents.GetComponent(m_ManholeCNO).Recordset != null)
                {
                    if (!(m_oRelatedComponents.GetComponent(m_ManholeCNO).Recordset.EOF&& m_oRelatedComponents.GetComponent(m_ManholeCNO).Recordset.BOF))
                    {
                        m_oRelatedComponents.GetComponent(m_ManholeCNO).Recordset.MoveFirst();

                        networkManaged    = Convert.ToString(m_oRelatedComponents.GetComponent(m_ManholeCNO).Recordset.Fields["NETWORK_MANAGED_YN"].Value);
                        networkRestricted = Convert.ToString(m_oRelatedComponents.GetComponent(m_ManholeCNO).Recordset.Fields["NETWORK_RESTRICTED_YN"].Value);
                    }
                }

                if (!m_oDataContext.IsRoleGranted("PRIV_DESIGN_NET") && networkManaged == "Y" && networkRestricted == "Y")
                {
                    validateMsg.Rule_Id = "NETMGMT01";
                    validateMsg.BuildRuleMessage(GTClassFactory.Create <IGTApplication>(), null);

                    ErrorMessageArray[0]  = validateMsg.Rule_MSG;
                    ErrorPriorityArray[0] = errorPriorityManaged;
                }

                if (!m_oDataContext.IsRoleGranted("PRIV_DESIGN_NET") && networkManaged == "N" && networkRestricted == "Y")
                {
                    validateMsg.Rule_Id = "NETMGMT02";
                    validateMsg.BuildRuleMessage(GTClassFactory.Create <IGTApplication>(), null);

                    ErrorMessageArray[0]  = validateMsg.Rule_MSG;
                    ErrorPriorityArray[0] = errorPriorityUnmanaged;
                }

                gtApplication.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, "Network Management Validation Completed");

                if (gTValidationLogger != null)
                {
                    gTValidationLogger.LogEntry("TIMING", "END", "Network Management Exit", "N/A", "");
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error in Network Management Relationship Attribute Interface:" + ex.Message);
            }
        }