Example #1
0
        /// <summary>
        /// Gets the lookup values for the specified category.
        /// </summary>
        /// <param name="category">The category of the lookup to get.</param>
        /// <returns>List of lookup values for the specified category.</returns>
        public List <LookupInfo> GetLookups(string category)
        {
            List <LookupInfo> lookups = new List <LookupInfo>();

            SqlParameter[] parameters = SQLHelper.GetCachedParameters("SQL_GET_LOOKUP_VALUES");

            if (parameters == null)
            {
                parameters = new SqlParameter[] {
                    new SqlParameter("@Category", SqlDbType.NVarChar, 250)
                };

                SQLHelper.CacheParameters("SQL_GET_LOOKUP_VALUES", parameters);
            }

            parameters[0].Value = category;

            // Execute a query to read the lookup values.
            using (SqlDataReader reader = SQLHelper.ExecuteReader(SQLHelper.CONNECTION_STRING,
                                                                  CommandType.Text, SQLHelper.GetSQLStatement(MODULE_NAME, "SQL_GET_LOOKUP_VALUES"),
                                                                  parameters))
            {
                while (reader.Read())
                {
                    LookupInfo lookup = new LookupInfo(reader.GetInt32(0), reader.GetString(1));

                    lookups.Add(lookup);
                }
            }

            return(lookups);
        }
Example #2
0
        /// <summary>
        /// Gets the lookup
        /// </summary>
        /// <param name="LookupId">The LookupId</param>
        /// <returns>Lookup Name</returns>
        public LookupInfo GetLookupDetails(int lookupId)
        {
            LookupInfo lookupdetails = new LookupInfo();

            SqlParameter[] parameters = SQLHelper.GetCachedParameters("SQL_GET_LOOKUPDETAILS");

            if (parameters == null)
            {
                parameters = new SqlParameter[] {
                    new SqlParameter("@LookupId", SqlDbType.Int)
                };

                SQLHelper.CacheParameters("SQL_GET_LOOKUPDETAILS", parameters);
            }

            parameters[0].Value = lookupId;

            // Execute a query to read the lookup values.
            using (SqlDataReader reader = SQLHelper.ExecuteReader(SQLHelper.CONNECTION_STRING,
                                                                  CommandType.Text, SQLHelper.GetSQLStatement(MODULE_NAME, "SQL_GET_LOOKUPDETAILS"),
                                                                  parameters))
            {
                while (reader.Read())
                {
                    lookupdetails = new LookupInfo(reader.GetInt32(0), reader.GetString(1));
                }
            }

            return(lookupdetails);
        }
Example #3
0
        /// <summary>
        /// Создание ограниченного шаблона для получения данных (только нужные поля).
        /// </summary>
        public static string GetAttrEntity(LookupInfo lookupInfo)
        {
            if (lookupInfo == null)
            {
                throw new ArgumentNullException("lookupInfo");
            }

            if (lookupInfo.ItemType == null)
            {
                lookupInfo.ItemType = GetItemSourceType(lookupInfo);
            }

            // если уже получали
            if (!string.IsNullOrEmpty(lookupInfo.AttrEntity))
            {
                return(lookupInfo.AttrEntity);
            }

            // строим шаблон
            lookupInfo.AttrEntity = string.IsNullOrEmpty(lookupInfo.DisplayMember)
                ? FilterHelper.GetAttrEntity(lookupInfo.ItemType, lookupInfo.ValueMember)
                : FilterHelper.GetAttrEntity(lookupInfo.ItemType, lookupInfo.ValueMember, lookupInfo.DisplayMember);

            return(lookupInfo.AttrEntity);
        }
Example #4
0
        public static LookupInfo AnnotateElement(XElement e)
        {
            var title = e.Element("title");
            var bnfid = e.Attribute("id").Value.Replace(".xml", "").Replace("#", "");
            var type  = GetTopicType(e);
            var slug  = RootIds.Contains(bnfid) ? "index" : bnfid;

            if (slug != "index" && title != null && TypesToSlug.Contains(type))
            {
                slug = Slugger.For(title.Value);
            }

            var lookup = new LookupInfo {
                BnfId = bnfid,
                Type  = type,
                Slug  = slug,
                Href  = type.SplitCamel() + "/" + slug + ".xml"
            };

            e.SetAttributeValue("id", lookup.Slug);
            e.SetAttributeValue("bnfid", lookup.BnfId);
            e.SetAttributeValue("type", lookup.Type);
            e.SetAttributeValue("Slug", lookup.Slug);
            e.SetAttributeValue("href", lookup.Href);

            return(lookup);
        }
Example #5
0
        private Boolean SelectFile()
        {
            openFileDialog1.InitialDirectory = LookupInfo.GetValue("FTP", "FTP_DIRECTORY_DOWNLOAD");
            string pre = "";

            if (FlagKtg == "INTI")
            {
                pre = "CI-";
            }
            else if (FlagKtg == "MITRAPS")
            {
                pre = "MPS-";
            }
            else if (FlagKtg == "MITRASAS")
            {
                pre = "MSAS-";
            }

            if (openFileDialog1.ShowDialog() == DialogResult.OK && openFileDialog1.FileName.Contains(pre))
            {
                dsXML.ReadXml(openFileDialog1.FileName);
                return(true);
            }
            else
            {
                MessageBox.Show("Data yang Anda Pilih Bukan Data Antar Gudang");
                return(false);
            }
        }
Example #6
0
 public static void Initialize()
 {
     userName    = LookupInfo.GetValue("FTP", "FTP_USER");
     password    = SecurityManager.DecodePassword(LookupInfo.GetValue("FTP", "FTP_PASSWORD"));
     dirDownload = LookupInfo.GetValue("FTP", "FTP_DIRECTORY_DOWNLOAD");
     dirUpload   = LookupInfo.GetValue("FTP", "FTP_DIRECTORY_UPLOAD");
     dirInbox    = LookupInfo.GetValue("FTP", "FTP_ADDRESS");
 }
Example #7
0
        //============================================================================
        // lookup
        //============================================================================
        public bool lookup(UInt32 address, ref LookupInfo info)
        {
            if (mDoEnumerate)
            {
                return(lookupEnumerated(address, ref info));
            }

            return(lookupImmediate(address, ref info));
        }
Example #8
0
    public LookupInfo GetLookupDetails(int lookupId)
    {
        // Get an instance of the Common BO
        Common bll = new Common();

        LookupInfo lookupdetails = bll.GetLookupDetails(lookupId);

        return(lookupdetails);
    }
Example #9
0
        static int BufferSize        = 1024 * 10000; //(10 MB buffer)

        public static void Initialize()
        {
            if (!isInitialized)
            {
                _passwordEnabled = bool.Parse(LookupInfo.GetValue("ZIP", "PASSWORD_ENABLED"));
                _password        = LookupInfo.GetValue("ZIP", "PASSWORD_ZIP");;
                isInitialized    = true;
            }
        }
Example #10
0
 public static void Initialize()
 {
     userName    = LookupInfo.GetValue("FTP", "FTP_USER");
     password    = Tools.DecodePassword(LookupInfo.GetValue("FTP", "FTP_PASSWORD"));
     dirDownload = LookupInfo.GetValue("FTP", "FTP_DIRECTORY_DOWNLOAD");
     ValidateDirectory(dirDownload);
     dirUpload = LookupInfo.GetValue("FTP", "FTP_DIRECTORY_UPLOAD");
     ValidateDirectory(dirUpload);
     dirInbox = LookupInfo.GetValue("FTP", "FTP_INBOX");
 }
Example #11
0
        private static bool MatchesLookupInfo(TagHelperDescriptor descriptor, LookupInfo lookupInfo)
        {
            if (!string.Equals(descriptor.AssemblyName, lookupInfo.AssemblyName, StringComparison.Ordinal))
            {
                return(false);
            }

            return(string.IsNullOrEmpty(lookupInfo.TypeName) ||
                   string.Equals(descriptor.TypeName, lookupInfo.TypeName, StringComparison.Ordinal));
        }
Example #12
0
        /// <summary>
        /// Remember IDs to reprocess later for this lookup relationship
        /// </summary>
        private void RemeberLookupIdsToReprocess(LookupInfo lookup, sObject obj)
        {
            var lookupField = obj.Any.FirstOrDefault(e => e.LocalName == lookup.FieldName);
            var relatedId   = lookupField.InnerText;

            if (!String.IsNullOrEmpty(relatedId))
            {
                lookup.IdPairs.Add(new KeyValuePair <string, string>(obj.Id, relatedId));
            }
        }
Example #13
0
        /// <summary>
        /// Gets the lookup details
        /// </summary>
        /// <param name="LookUpId">LookupId</param>
        /// <returns>Lookup Details</returns>
        public LookupInfo GetLookupDetails(int lookupId)
        {
            // Get an instance of the Common DAO using the DALFactory
            ICommon dao = (ICommon)DALFactory.DAO.Create(DALFactory.Module.Common);

            LookupInfo lookupdetails = new LookupInfo();

            lookupdetails = dao.GetLookupDetails(lookupId);

            return(lookupdetails);
        }
Example #14
0
        private TaxFormulaCalculatedOnInfo GetTaxFormulaChargeCaculatedOnValues(DataRow dr)
        {
            TaxFormulaCalculatedOnInfo taxformulachargecalcultedon = new TaxFormulaCalculatedOnInfo();

            if (dr["TaxFormulaChargesId"] != DBNull.Value)
            {
                taxformulachargecalcultedon.TaxFormulaChargeId = Convert.ToInt32(dr["TaxFormulaChargesId"]);
            }

            if (dr["ChargesId"] != DBNull.Value)
            {
                taxformulachargecalcultedon.TaxChargesId = Convert.ToInt32(dr["ChargesId"]);
            }

            if (dr["ChargesName"] != DBNull.Value)
            {
                taxformulachargecalcultedon.TaxChargesName = Convert.ToString(dr["ChargesName"]);
            }

            if (dr["IsFixPrice"] != DBNull.Value)
            {
                taxformulachargecalcultedon.IsFixPrice = Convert.ToBoolean(dr["IsFixPrice"]);
            }

            if (dr["CalculatedOnId"] != DBNull.Value)
            {
                taxformulachargecalcultedon.CalculatedOnId = Convert.ToInt32(dr["CalculatedOnId"]);
            }

            List <KeyValueInfo> GetChargesRateTypes = LookupInfo.GetChargesRateTypes();

            if (taxformulachargecalcultedon.CalculatedOnId == 1)
            {
                taxformulachargecalcultedon.CalculatedOnName = GetChargesRateTypes[0].Value;
            }
            if (taxformulachargecalcultedon.CalculatedOnId == 2)
            {
                taxformulachargecalcultedon.CalculatedOnName = GetChargesRateTypes[1].Value;
            }
            if (taxformulachargecalcultedon.CalculatedOnId == 3)
            {
                taxformulachargecalcultedon.CalculatedOnName = GetChargesRateTypes[2].Value;
            }


            if (dr["Behaviour"] != DBNull.Value)
            {
                taxformulachargecalcultedon.Behaviour = Convert.ToString(dr["Behaviour"]);
            }

            return(taxformulachargecalcultedon);
        }
 private void SelectFile()
 {
     openFileDialog1.InitialDirectory = LookupInfo.GetValue("FTP", "FTP_DIRECTORY_DOWNLOAD");
     if (openFileDialog1.ShowDialog() == DialogResult.OK && openFileDialog1.FileName.Contains("MasterOutletBaru-"))
     {
         ReadData(openFileDialog1.FileName);
     }
     else
     {
         MessageBox.Show("Data yang Anda Pilih Bukan Data Master Outlet");
         SelectFile();
     }
 }
Example #16
0
        private void AddKodeKasus()
        {
            DataTable dk = new DataTable();

            dk = LookupInfo.GetList("KodeKasus").Copy();
            DataColumn cConcatenated = new DataColumn("Concatenated", Type.GetType("System.String"), "LookupCode + ' | ' + Value");

            dk.Columns.Add(cConcatenated);
            dk.Rows.Add("");
            dk.DefaultView.Sort = "Value ASC";

            cboKodeKasus.DataSource    = dk;
            cboKodeKasus.DisplayMember = "Concatenated";
            cboKodeKasus.ValueMember   = "LookupCode";
        }
Example #17
0
        public static void Initialize()
        {
            userName = LookupInfo.GetValue("FTP", "FTP_USER");
            password = Tools.DecodePassword(LookupInfo.GetValue("FTP", "FTP_PASSWORD"));

            dirUpload = LookupInfo.GetValue("09JKT_DEV", "FTP_ADDRESSLIST");
            ValidateDirectory(dirUpload);

            dirUpload = LookupInfo.GetValue("FTP", "FTP_DIRECTORY_UPLOAD");
            ValidateDirectory(dirUpload);


            dirPath = LookupInfo.GetValue("FTP", "FTP_DIRECTORY_UPLOAD"); ///uji coba
            ValidateDirectory(dirPath);
        }
Example #18
0
        private ProcessInfo Get_Process_Values(DataRow dr)
        {
            ProcessInfo process = new ProcessInfo();

            process.Process_Id   = Convert.ToInt32(dr["Process_Id"]);
            process.Process_Name = Convert.ToString(dr["Process_Name"]);
            process.Is_Active    = Convert.ToBoolean(dr["Is_Active"]);
            process.Article_Type = Convert.ToInt32(dr["Article_Type"]);
            process.CreatedOn    = Convert.ToDateTime(dr["CreatedOn"]);
            process.CreatedBy    = Convert.ToInt32(dr["CreatedBy"]);
            process.UpdatedOn    = Convert.ToDateTime(dr["UpdatedOn"]);
            process.UpdatedBy    = Convert.ToInt32(dr["UpdatedBy"]);

            process.Article_Type_Name = LookupInfo.Get_Article_Types()[process.Article_Type];

            return(process);
        }
Example #19
0
        private AttributeCodeInfo Get_Attribute_Code_Values(DataRow dr)
        {
            AttributeCodeInfo attributeCodes = new AttributeCodeInfo();

            attributeCodes.Attribute_Code_Id = Convert.ToInt32(dr["Attribute_Code_Id"]);

            attributeCodes.Attribute_Id = Convert.ToInt32(dr["Attribute_Id"]);

            attributeCodes.Attribute_Code_Name = Convert.ToString(dr["Attribute_Code_Name"]);

            attributeCodes.Code = Convert.ToString(dr["Code"]);

            attributeCodes.Status = Convert.ToBoolean(dr["Status"]);

            attributeCodes.Attribute_Name = LookupInfo.GetAttributeNames()[attributeCodes.Attribute_Id];

            return(attributeCodes);
        }
Example #20
0
        private static bool MatchesLookupInfo(TagHelperDescriptor descriptor, LookupInfo lookupInfo)
        {
            if (!string.Equals(descriptor.AssemblyName, lookupInfo.AssemblyName, StringComparison.Ordinal))
            {
                return(false);
            }

            // We need to escape the TypePattern so we can choose to only allow specific regex.
            var escaped = Regex.Escape(lookupInfo.TypePattern);

            // We surround the escaped with ^ and $ in order ot ensure a regex match matches the entire
            // string. We also replace any '*' or '?' characters with regex to match appropriate content.
            // '*' matches 0 or more characters lazily and '?' matches 1 character.
            var pattern = "^" + escaped.Replace(@"\?", ".").Replace(@"\*", ".*?") + "$";
            var regex   = new Regex(pattern, RegexOptions.Singleline);

            return(regex.IsMatch(descriptor.TypeName));
        }
Example #21
0
        private void SelectFile()
        {
            //openFileDialog1.InitialDirectory = LookupInfo.GetValue("FTP", "FTP_DIRECTORY_DOWNLOAD");
            //if (openFileDialog1.ShowDialog() == DialogResult.OK && openFileDialog1.FileName.Contains("PO"))
            //{
            //   ReadData(openFileDialog1.FileName);
            //}
            //else
            //{
            //    MessageBox.Show("Data yang Anda Pilih Bukan Data Refilll PO");
            //    SelectFile();
            //}

            openFileDialog1.InitialDirectory = LookupInfo.GetValue("FTP", "FTP_DIRECTORY_DOWNLOAD");
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                ReadData(openFileDialog1.FileName);
            }
        }
Example #22
0
        internal override bool CalculateLookup(LookupInfo lookup)
        {
            OnDemandProcessingContext odpWorkerContextForTablixProcessing = GetOdpWorkerContextForTablixProcessing();

            Microsoft.ReportingServices.ReportIntermediateFormat.DataSet dataSet = m_odpContext.ReportDefinition.MappingDataSetIndexToDataSet[lookup.DataSetIndexInCollection];
            if (odpWorkerContextForTablixProcessing.GetDataSetInstance(dataSet) != null)
            {
                if (!odpWorkerContextForTablixProcessing.IsTablixProcessingComplete(dataSet.IndexInCollection))
                {
                    if (odpWorkerContextForTablixProcessing.IsTablixProcessingMode)
                    {
                        return(false);
                    }
                    ((OnDemandStateManagerFull)odpWorkerContextForTablixProcessing.StateManager).PerformOnDemandTablixProcessingWithContextRestore(dataSet);
                }
                return(true);
            }
            return(false);
        }
Example #23
0
        public static bool IsPasswordExpired()
        {
            bool expired = false;


            int maxAge = int.Parse(LookupInfo.GetValue("SECURITY", "PASSWORD_AGE"));

            if (maxAge > 0)
            {
                int datediff = DateTime.Now.Subtract(SecurityManager.TglPassword).Days;

                if (datediff > maxAge)
                {
                    expired = true;
                }
            }

            return(expired);
        }
Example #24
0
                public SubscriptionInfo(Subscription subscription)
                {
                    Subscription = subscription ?? throw new ArgumentNullException(nameof(subscription));

                    if (Subscription.CandleSeries != null)
                    {
                        Holder = new CandlesSeriesHolder(subscription.CandleSeries);
                    }

                    var type = subscription.DataType;

                    if (type == DataType.PositionChanges ||
                        type == DataType.Securities ||
                        type == DataType.Board ||
                        subscription.SubscriptionMessage is TimeFrameLookupMessage)
                    {
                        Lookup = new LookupInfo(subscription.SubscriptionMessage);
                    }
                }
Example #25
0
        public static void RecordLoginAttempt(string userID)
        {
            try
            {
                int maxAttempt = int.Parse(LookupInfo.GetValue("SECURITY", "MAX_LOGIN_ATTEMPT"));

                using (Database db = new Database())
                {
                    db.Commands.Add(db.CreateCommand("usp_SecurityLoginAttempt_INSERT"));
                    db.Commands[0].Parameters.Add(new Parameter("@userID", SqlDbType.VarChar, userID));
                    db.Commands[0].Parameters.Add(new Parameter("@tglLogin", SqlDbType.DateTime, DateTime.Now));
                    db.Commands[0].Parameters.Add(new Parameter("@ipAddress", SqlDbType.VarChar, SecurityManager.ClientIPAddress));
                    db.Commands[0].ExecuteNonQuery();
                }
            }
            catch (Exception ex)
            {
                Error.LogError(ex);
            }
        }
Example #26
0
        public GCListView(string fieldName, string lookupCode = "")
            : this()
        {
            if (string.IsNullOrEmpty(lookupCode))
            {
                throw new DeveloperException("LookupCode is null");
            }

            _lookupInfo = LookupHelper.GetLookupInfo(lookupCode);
            _itemType   = _lookupInfo.ItemType;

            if (_itemType == null)
            {
                throw new DeveloperException("Type of itemType is null.");
            }

            SubListParentFieldName = fieldName;
            FillFields();

            DataContextChanged += OnDataContextChanged;
        }
        public override bool CalculateLookup(LookupInfo lookup)
        {
            OnDemandProcessingContext odpWorkerContextForTablixProcessing = base.GetOdpWorkerContextForTablixProcessing();

            AspNetCore.ReportingServices.ReportIntermediateFormat.DataSet         dataSet         = base.m_odpContext.ReportDefinition.MappingDataSetIndexToDataSet[lookup.DataSetIndexInCollection];
            AspNetCore.ReportingServices.ReportIntermediateFormat.DataSetInstance dataSetInstance = odpWorkerContextForTablixProcessing.GetDataSetInstance(dataSet);
            if (dataSetInstance != null)
            {
                if (!odpWorkerContextForTablixProcessing.IsTablixProcessingComplete(dataSet.IndexInCollection))
                {
                    if (odpWorkerContextForTablixProcessing.IsTablixProcessingMode)
                    {
                        return(false);
                    }
                    OnDemandStateManagerFull onDemandStateManagerFull = (OnDemandStateManagerFull)odpWorkerContextForTablixProcessing.StateManager;
                    onDemandStateManagerFull.PerformOnDemandTablixProcessingWithContextRestore(dataSet);
                }
                return(true);
            }
            return(false);
        }
Example #28
0
        public bool lookupEnumerated(UInt32 address, ref LookupInfo info)
        {
            try
            {
                info.mAddress     = address;
                info.mLine        = -1;
                info.mFilename    = "?";
                info.mSymbol      = "?";
                info.mFoundLine   = false;
                info.mFoundSymbol = false;


                for (int i = 0; i < mSymbolDat.Count; i++)
                {
                    if (mSymbolDat[i].mAddress == address)
                    {
                        info.mFoundSymbol = true;
                        info.mSymbol      = mSymbolNames[(int)mSymbolDat[i].mNameIndex];
                        break;
                    }
                }


                {
                    LineDesc ld = (LineDesc)mAddressHash.getObjNearAddress(address);

                    if (ld != null)
                    {
                        info.mFoundLine = true;
                        info.mLine      = ld.mLine;
                        info.mFilename  = mFileNames[(int)ld.mFilenameIndex];
                        return(true);
                    }
                }
            }
            catch (Exception e)
            {
            }
            return(false);
        }
Example #29
0
                public SubscriptionInfo(Subscription subscription, bool keepAfterFinish)
                {
                    Subscription    = subscription ?? throw new ArgumentNullException(nameof(subscription));
                    KeepAfterFinish = keepAfterFinish;

                    if (Subscription.CandleSeries != null)
                    {
                        Holder = new CandlesSeriesHolder(subscription.CandleSeries);
                    }

                    _last = subscription.SubscriptionMessage.From;

                    var type = subscription.DataType;

                    if (type == DataType.PositionChanges ||
                        type == DataType.Securities ||
                        type == DataType.Board ||
                        type == DataType.TimeFrames)
                    {
                        Lookup = new LookupInfo(subscription.SubscriptionMessage);
                    }
                }
        private static bool MatchesLookupInfo(TagHelperDescriptor descriptor, LookupInfo lookupInfo)
        {
            if (!string.Equals(descriptor.AssemblyName, lookupInfo.AssemblyName, StringComparison.Ordinal))
            {
                return(false);
            }

            if (lookupInfo.TypePattern.EndsWith("*", StringComparison.Ordinal))
            {
                if (lookupInfo.TypePattern.Length == 1)
                {
                    // TypePattern is "*".
                    return(true);
                }

                var lookupTypeName = lookupInfo.TypePattern.Substring(0, lookupInfo.TypePattern.Length - 1);

                return(descriptor.TypeName.StartsWith(lookupTypeName, StringComparison.Ordinal));
            }

            return(string.Equals(descriptor.TypeName, lookupInfo.TypePattern, StringComparison.Ordinal));
        }
        private static bool MatchesLookupInfo(TagHelperDescriptor descriptor, LookupInfo lookupInfo)
        {
            if (!string.Equals(descriptor.AssemblyName, lookupInfo.AssemblyName, StringComparison.Ordinal))
            {
                return false;
            }

            // We need to escape the TypePattern so we can choose to only allow specific regex.
            var escaped = Regex.Escape(lookupInfo.TypePattern);

            // We surround the escaped with ^ and $ in order ot ensure a regex match matches the entire 
            // string. We also replace any '*' or '?' characters with regex to match appropriate content.
            // '*' matches 0 or more characters lazily and '?' matches 1 character.
            var pattern = "^" + escaped.Replace(@"\?", ".").Replace(@"\*", ".*?") + "$";
            var regex = new Regex(pattern, RegexOptions.Singleline);

            return regex.IsMatch(descriptor.TypeName);
        }
        private static bool MatchesLookupInfo(TagHelperDescriptor descriptor, LookupInfo lookupInfo)
        {
            if (!string.Equals(descriptor.AssemblyName, lookupInfo.AssemblyName, StringComparison.Ordinal))
            {
                return false;
            }

            if (lookupInfo.TypePattern.EndsWith("*", StringComparison.Ordinal))
            {
                if (lookupInfo.TypePattern.Length == 1)
                {
                    // TypePattern is "*".
                    return true;
                }

                var lookupTypeName = lookupInfo.TypePattern.Substring(0, lookupInfo.TypePattern.Length - 1);

                return descriptor.TypeName.StartsWith(lookupTypeName, StringComparison.Ordinal);
            }

            return string.Equals(descriptor.TypeName, lookupInfo.TypePattern, StringComparison.Ordinal);
        }
Example #33
0
        public static LookupInfo AnnotateElement(XElement e)
        {
            var title = e.Element("title");
            var bnfid = e.Attribute("id").Value.Replace(".xml", "").Replace("#", "");
            var type = GetTopicType(e);
            var slug = RootIds.Contains(bnfid) ? "index" : bnfid;

            if (slug != "index" && title != null && TypesToSlug.Contains(type))
                slug = Slugger.For(title.Value);

            var lookup = new LookupInfo {
                BnfId = bnfid,
                Type = type,
                Slug = slug,
                Href = type.SplitCamel () + "/" + slug + ".xml"
            };

            e.SetAttributeValue("id", lookup.Slug);
            e.SetAttributeValue("bnfid", lookup.BnfId);
            e.SetAttributeValue("type", lookup.Type);
            e.SetAttributeValue("Slug", lookup.Slug);
            e.SetAttributeValue("href", lookup.Href);

            return lookup;
        }