Esempio n. 1
0
        /// <summary>
        /// Gets the Global Attribute values for the specified key.
        /// </summary>
        /// <param name="key">The key.</param>
        /// <param name="rockContext">The rock context.</param>
        /// <returns></returns>
        public string GetValue(string key, RockContext rockContext)
        {
            string value;

            if (AttributeValues.TryGetValue(key, out value))
            {
                return(value);
            }

            var attributeCache = Attributes.FirstOrDefault(a => a.Key.Equals(key, StringComparison.OrdinalIgnoreCase));

            if (attributeCache == null)
            {
                return(string.Empty);
            }

            if (rockContext != null)
            {
                return(GetValue(key, attributeCache, rockContext));
            }

            using (var myRockContext = new RockContext())
            {
                return(GetValue(key, attributeCache, myRockContext));
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Validates the rule against the specified values
        /// </summary>
        /// <param name="values">The values to evaluate</param>
        public void Validate(AttributeValues values)
        {
            if (this.AcmaSchemaMapping.Attribute != values.Attribute)
            {
                return;
            }

            if (values.IsEmptyOrNull)
            {
                if (this.NullAllowed)
                {
                    return;
                }
                else
                {
                    throw new SafetyRuleViolationException(this.Name, "null");
                }
            }

            foreach (AttributeValue value in values)
            {
                if (!this.PatternRegex.IsMatch(value.ToSmartString()))
                {
                    throw new SafetyRuleViolationException(this.Name, value.ToSmartString());
                }
            }
        }
Esempio n. 3
0
        //Arrays.asList("screenOrientation", "configChanges", "windowSoftInputMode", "launchMode", "installLocation", "protectionLevel"));

        //trans int attr value to string
        private string getFinalValueAsString(string attributeName, string str)
        {
            uint value = uint.Parse(str);

            switch (attributeName)
            {
            case "screenOrientation":
                return(AttributeValues.getScreenOrientation(value));

            case "configChanges":
                return(AttributeValues.getConfigChanges(value));

            case "windowSoftInputMode":
                return(AttributeValues.getWindowSoftInputMode(value));

            case "launchMode":
                return(AttributeValues.getLaunchMode(value));

            case "installLocation":
                return(AttributeValues.getInstallLocation(value));

            case "protectionLevel":
                return(AttributeValues.getProtectionLevel(value));

            default:
                return(str);
            }
        }
Esempio n. 4
0
 public RedirectToRouteResult AttributeValueEdit(int productId, AttributeViewModel attributeViewModel)
 {
     using (ShopDbDataContext db = new ShopDbDataContext())
     {
         foreach (KeyValuePair <string, string> attrVal in attributeViewModel.AttributeValuesDict)
         {
             var ifExistAttrValue = db.AttributeValues.First(av => av.ProductId == productId && av.AttributeId == int.Parse(attrVal.Key));
             if (ifExistAttrValue != null)
             {
                 ifExistAttrValue.Value = attrVal.Value;
                 db.SubmitChanges();
             }
             else
             {
                 AttributeValues attributeValues = new AttributeValues
                 {
                     ProductId   = productId,
                     AttributeId = int.Parse(attrVal.Key),
                     Value       = attrVal.Value
                 };
                 db.AttributeValues.InsertOnSubmit(attributeValues);
                 db.SubmitChanges();
             }
         }
     }
     return(RedirectToAction("ProductEdit", "Admin"));
 }
Esempio n. 5
0
        public ActionResult Product(int productID)
        {
            var product = Products.GetByID(productID).Clone(UserID);

            product.CreatedDate = DateTime.Now;

            Products.Insert(product);

            foreach (var item in ProductGroups.GetByProductID(productID))
            {
                ProductGroups.Insert(new ProductGroup()
                {
                    ProductID = product.ID,
                    GroupID   = item.GroupID
                });
            }

            foreach (var item in AttributeValues.GetByProductID(productID))
            {
                AttributeValues.Insert(new AttributeValue()
                {
                    ProductID         = product.ID,
                    AttributeID       = item.AttributeID,
                    AttributeOptionID = item.AttributeOptionID,
                    Value             = item.Value
                });
            }

            return(Redirect("/Admin/Products/Edit/" + product.ID));
        }
Esempio n. 6
0
        public JsonResult GetAttributes(int productID, List <int> groupIDs)
        {
            var jsonSuccessResult = new JsonSuccessResult();

            try
            {
                var attrs = Attributes.GetByGroupIDs(groupIDs);

                if (productID != -1)
                {
                    foreach (var item in attrs)
                    {
                        item.Value = AttributeValues.GetValue(productID, item.ID);
                    }
                }

                jsonSuccessResult.Data    = attrs;
                jsonSuccessResult.Success = true;
            }
            catch (Exception ex)
            {
                jsonSuccessResult.Errors  = new string[] { ex.Message };
                jsonSuccessResult.Success = false;
            }

            return(new JsonResult()
            {
                Data = jsonSuccessResult
            });
        }
Esempio n. 7
0
 private string GetValue( string key, AttributeCache attributeCache, RockContext rockContext )
 {
     var attributeValue = new AttributeValueService( rockContext ).GetByAttributeIdAndEntityId( attributeCache.Id, null );
     var value = ( !string.IsNullOrEmpty( attributeValue?.Value ) ) ? attributeValue.Value : attributeCache.DefaultValue;
     AttributeValues.AddOrUpdate( key, value, ( k, v ) => value );
     return value;
 }
Esempio n. 8
0
        public void Store()
        {
            var request      = new StoreRequest();
            var newAttribute = new AttributeValues(incrementingAttribute,
                                                   "val" + (incrementingAttributeValue++).ToString(),
                                                   "val" + (incrementingAttributeValue++).ToString()
                                                   );

            request.AddAttribute(newAttribute);

            var response = ParameterizedTest <StoreResponse>(
                TestSupport.Scenarios.ExtensionFullCooperation, Version, request);

            Assert.IsNotNull(response);
            Assert.IsTrue(response.Succeeded);
            Assert.IsNull(response.FailureReason);

            var fetchRequest = new FetchRequest();

            fetchRequest.AddAttribute(new AttributeRequest {
                TypeUri = incrementingAttribute
            });
            var fetchResponse = ParameterizedTest <FetchResponse>(
                TestSupport.Scenarios.ExtensionFullCooperation, Version, fetchRequest);

            Assert.IsNotNull(fetchResponse);
            var att = fetchResponse.GetAttribute(incrementingAttribute);

            Assert.IsNotNull(att);
            Assert.AreEqual(newAttribute.Values.Count, att.Values.Count);
            for (int i = 0; i < newAttribute.Values.Count; i++)
            {
                Assert.AreEqual(newAttribute.Values[i], att.Values[i]);
            }
        }
Esempio n. 9
0
        private void Parse(XmlReader reader, bool nestedElement)
        {
            if (reader.MoveToFirstAttribute())
            {
                do
                {
                    if (!nestedElement)
                    {
                        if (reader.LocalName?.Equals("xmlns", StringComparison.OrdinalIgnoreCase) == true)
                        {
                            continue;
                        }
                        if (reader.Prefix?.Equals("xsi", StringComparison.OrdinalIgnoreCase) == true)
                        {
                            continue;
                        }
                        if (reader.Prefix?.Equals("xmlns", StringComparison.OrdinalIgnoreCase) == true)
                        {
                            continue;
                        }
                    }

                    if (!AttributeValues.ContainsKey(reader.LocalName))
                    {
                        AttributeValues.Add(reader.LocalName, reader.Value);
                    }
                    else
                    {
                        string message = $"Duplicate attribute detected. Attribute name: [{reader.LocalName}]. Duplicate value:[{reader.Value}], Current value:[{AttributeValues[reader.LocalName]}]";
                        _parsingErrors.Add(message);
                    }
                }while (reader.MoveToNextAttribute());
                reader.MoveToElement();
            }

            LocalName = reader.LocalName;

            if (!reader.IsEmptyElement)
            {
                while (reader.Read())
                {
                    if (reader.NodeType == XmlNodeType.EndElement)
                    {
                        break;
                    }

                    if (reader.NodeType == XmlNodeType.CDATA || reader.NodeType == XmlNodeType.Text)
                    {
                        Value += reader.Value;
                        continue;
                    }

                    if (reader.NodeType == XmlNodeType.Element)
                    {
                        Children.Add(new NLogXmlElement(reader, true));
                    }
                }
            }
        }
Esempio n. 10
0
 private void SetCurrentMinigame()
 {
     for (int counter = 0; counter < minigameValues.Length; counter++)
     {
         AttributeValues game = GetMatchingValues(minigameValues[counter].Param1, minigameValues[counter].Param2);
         SetMinigame(game.Icon, minigameValues[counter].Value - 1, counter + 1);
     }
 }
Esempio n. 11
0
        public void AddAttributeByValue()
        {
            var             req   = new StoreRequest();
            AttributeValues value = new AttributeValues();

            req.Attributes.Add(value);
            Assert.AreSame(value, req.Attributes.Single());
        }
Esempio n. 12
0
 protected static TimeSeries createEmptyTestSeries()
 {
     emptySeriesId++;
     return(TimeSeries.create("empty test series " + emptySeriesId, AttributeValues.values(new[] {
         Attribute.QUOTE_SIDE.value(new[] { "test" }),
         Attribute.INDEX_SERIES.value(new[] { "" + emptySeriesId })
     })));
 }
Esempio n. 13
0
        public ActionResult DeleteConfirmed(int id)
        {
            AttributeValues attributeValues = db.AttributeValues.Find(id);

            db.AttributeValues.Remove(attributeValues);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 14
0
        static void Main(string[] args)
        {
            if (args.Length < 1)
            {
                System.Console.WriteLine("Must provide a file name as an argument.");
                System.Console.ReadLine();
                return;
            }

            System.Console.WriteLine("Parsing file '{0}'.", args[0]);
            var parser  = new FileParser();
            var sources = parser.Parse(args[0]);

            sources.UseAttributesWithValues = false;

            System.Console.WriteLine("Done parsing.  Parsed {0} data sources.", sources.Count);

            var attributeValues = new AttributeValues();

            attributeValues.FindValues(sources);
            System.Console.WriteLine("Done finding attribute values.");
            System.Console.WriteLine();

            int itemId;

            if (args.Length < 2)
            {
                var rand  = new Random();
                int index = rand.Next(attributeValues.ValuesMap[LootGainLib.Attribute.Loot].Keys.Count);
                itemId = (int)attributeValues.ValuesMap[LootGainLib.Attribute.Loot].Keys.ToList()[index];
            }
            else
            {
                itemId = int.Parse(args[1]);
            }

            PrintSingleItem(itemId, sources, attributeValues);
            System.Console.WriteLine();
            System.Console.WriteLine();

            string sourceName;

            if (args.Length < 3)
            {
                var rand  = new Random();
                int index = rand.Next(attributeValues.ValuesMap[LootGainLib.Attribute.SourceName].Keys.Count);
                sourceName = (string)attributeValues.ValuesMap[LootGainLib.Attribute.SourceName].Keys.ToList()[index];
            }
            else
            {
                sourceName = args[2];
            }

            PrintSingleSource(sourceName, sources);


            System.Console.ReadLine();
        }
Esempio n. 15
0
        private void b_icon_Click(object sender, EventArgs e)
        {
            Button          button = (Button)sender;
            AttributeValues value  = (AttributeValues)button.Tag;

            int newIndex = CheckIfLAreadyExists(((int)value.Icon + 1) % 15);

            SetMinigameInfos(button, newIndex, GetNumberOfAchieves((int)values[newIndex].Icon), p_icons.Controls.IndexOf(button));
        }
Esempio n. 16
0
        static void PrintSingleItem(int itemId, DataSourcesCollection sources, AttributeValues attributeValues)
        {
            var loot = from s in sources
                       from l in s.Loot
                       where !string.IsNullOrWhiteSpace(l.ItemLink)
                       where (l.ItemLink.Contains("item:" + itemId.ToString() + ":") ||
                              l.ItemLink.Contains("currency:" + itemId.ToString() + "|")) ||
                       (itemId == 0 && l.IsCoin.HasValue && l.IsCoin.Value)
                       select l;
            var singleLoot = loot.FirstOrDefault();

            if (singleLoot == null)
            {
                System.Console.WriteLine("No known item with item id '{0}'.", itemId);
                return;
            }

            var item = ItemInfo.ParseItemString(singleLoot.ItemLink);

            System.Console.WriteLine("Loot Type: {0}, Id: {1}, Item Name: {2}", item.LinkType, item.Id, item.Name);
            //itemId = 6303;
            //itemId = 45191;
            //itemId = 82261;

            //int itemId = int.Parse(args[1]);
            var entropy = sources.EntropyOnItemId(item.Id);

            System.Console.WriteLine("Base entropy: {0}", entropy);

            /*
             * var informationGain = sources.InformationGainOnItemId(itemId, LootGainLib.Attribute.SourceName, null,
             *  attributeValues.ValuesMap[LootGainLib.Attribute.SourceName]);
             * System.Console.WriteLine("Information gain on source name: {0}", informationGain);
             *
             * informationGain = sources.InformationGainOnItemId(itemId, LootGainLib.Attribute.ZoneName, null,
             *  attributeValues.ValuesMap[LootGainLib.Attribute.ZoneName]);
             * System.Console.WriteLine("Information gain on zone name: {0}", informationGain);
             * */

            /*
             * LootGainLib.Attribute bestAttribute;
             * object bestAttributeValue;
             * double bestInformationGain = sources.FindGreatestInformationGain(itemId, attributeValues,
             *  out bestAttribute, out bestAttributeValue);
             * System.Console.WriteLine("Completed finding greatest information gain.  Attribute {0} with value {1} at {2}.",
             *  bestAttribute.ToString(), bestAttributeValue, bestInformationGain);
             * */

            DecisionTreeNode rootNode = new DecisionTreeNode()
            {
                Sources = sources,
                ItemId  = itemId,
            };

            rootNode.CreateChildrenOnItemId(itemId, attributeValues);
            rootNode.ConsolePrint(string.Empty);
        }
Esempio n. 17
0
        public virtual void AddAttributeValue(Guid attributeValueId)
        {
            if (AttributeValues.Any(x => x.AttributeId == attributeValueId))
            {
                AttributeValues.RemoveAll(x => x.AttributeId == attributeValueId);
            }

            AttributeValues.Add(new ProductAttribute(Id, attributeValueId));
        }
Esempio n. 18
0
        /*
         *  Developer: Azeem Hassan
         *  Date: 7-5-19
         *  Action: Update AttributeValues to database
         *  Input: AttributeValuesToUpdate
         *  output: result
         */
        public async Task <Boolean> Update(AttributeValues AttributeValuesToUpdate)
        {
            using (IDbConnection conn = Connection)
            {
                var result = await conn.UpdateAsync <AttributeValues>(AttributeValuesToUpdate);

                return(result);
            }
        }
Esempio n. 19
0
        /// <summary>
        /// Gets the optional boolean attribute value.
        /// </summary>
        /// <param name="attributeName">Name of the attribute.</param>
        /// <param name="defaultValue">Default value to return if the attribute is not found.</param>
        /// <returns>Boolean attribute value or default.</returns>
        public bool GetOptionalBooleanAttribute(string attributeName, bool defaultValue)
        {
            if (!AttributeValues.TryGetValue(attributeName, out var value))
            {
                return(defaultValue);
            }

            return(Convert.ToBoolean(value, CultureInfo.InvariantCulture));
        }
Esempio n. 20
0
        private IComparable GetMaxValue()
        {
            if (IsCoverageLayer)
            {
                return(((ICoverageLayer)layer).MaxValue);
            }

            return((AttributeValues != null) ? AttributeValues.Max() : null);
        }
Esempio n. 21
0
        public TValue[] TryGetParamsAttributeValue <TValue>(int index, TValue[] defaultValue = null)
        {
            if (AttributeValues.Length <= index)
            {
                return(defaultValue);
            }

            return(AttributeValues[index].GetValue <object>() as TValue[] ??
                   AttributeValues.Skip(index).OfType <TValue>().ToArray());
        }
 public DescriptionAttributeAnnotationBase(AnnotationType annotationType, QualifiedSelection qualifiedSelection, VBAParser.AnnotationContext context, IEnumerable <string> attributeValues)
     : base(annotationType, qualifiedSelection, context, attributeValues?.Take(1).ToList())
 {
     Description = AttributeValues?.FirstOrDefault();
     if ((Description?.StartsWith("\"") ?? false) && Description.EndsWith("\""))
     {
         // strip surrounding double quotes
         Description = Description.Substring(1, Description.Length - 2);
     }
 }
Esempio n. 23
0
        public void AddAttributeByPrimitives()
        {
            var req = new StoreRequest();

            req.Attributes.Add("http://att1", "value1", "value2");
            AttributeValues value = req.Attributes.Single();

            Assert.AreEqual("http://att1", value.TypeUri);
            Assert.IsTrue(MessagingUtilities.AreEquivalent(new[] { "value1", "value2" }, value.Values));
        }
Esempio n. 24
0
        /// <summary>
        /// Gets the optional attribute value.
        /// </summary>
        /// <param name="attributeName">Name of the attribute.</param>
        /// <param name="defaultValue">The default value.</param>
        /// <returns>Value of the attribute or default value.</returns>
        public string GetOptionalAttribute(string attributeName, string defaultValue)
        {
            string value;

            if (!AttributeValues.TryGetValue(attributeName, out value))
            {
                value = defaultValue;
            }

            return(value);
        }
Esempio n. 25
0
 public ActionResult Edit(AttributeValues attributeValues)
 {
     if (ModelState.IsValid)
     {
         db.Entry(attributeValues).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.AttributeId = new SelectList(db.Attributes, "Id", "Name", attributeValues.AttributeId);
     return(View(attributeValues));
 }
Esempio n. 26
0
        /// <summary>
        /// Sets the value.
        /// </summary>
        /// <param name="key">The key.</param>
        /// <param name="value">The value.</param>
        /// <param name="saveValue">if set to <c>true</c> [save value].</param>
        /// <param name="rockContext">The rock context.</param>
        public void SetValue(string key, string value, bool saveValue, RockContext rockContext)
        {
            if (saveValue)
            {
                // Save new value
                rockContext = rockContext ?? new RockContext();
                var attributeValueService = new AttributeValueService(rockContext);
                var attributeValue        = attributeValueService.GetGlobalAttributeValue(key);

                if (attributeValue == null)
                {
                    var attributeService = new AttributeService(rockContext);
                    var attribute        = attributeService.GetGlobalAttribute(key);
                    if (attribute == null)
                    {
                        attribute = new Model.Attribute
                        {
                            FieldTypeId = FieldTypeCache.Get(new Guid(SystemGuid.FieldType.TEXT)).Id,
                            EntityTypeQualifierColumn = string.Empty,
                            EntityTypeQualifierValue  = string.Empty,
                            Key  = key,
                            Name = key.SplitCase()
                        };
                        attributeService.Add(attribute);
                        rockContext.SaveChanges();
                    }

                    attributeValue = new AttributeValue
                    {
                        IsSystem    = false,
                        AttributeId = attribute.Id
                    };
                    attributeValueService.Add(attributeValue);
                }

                attributeValue.Value = value;
                rockContext.SaveChanges();
            }

            lock ( _obj )
            {
                _attributeIds = null;
            }

            AttributeValues.AddOrUpdate(key, value, (k, v) => value);

            var attributeCache = Attributes.FirstOrDefault(a => a.Key.Equals(key, StringComparison.OrdinalIgnoreCase));

            if (attributeCache != null)
            {
                value = attributeCache.FieldType.Field.FormatValue(null, value, attributeCache.QualifierValues, false);
            }
            AttributeValuesFormatted.AddOrUpdate(key, value, (k, v) => value);
        }
        public void ReferenceLookupUseAllResults()
        {
            ReferenceLookupConstructor constructor = new ReferenceLookupConstructor();

            constructor.Attribute            = ActiveConfig.DB.GetAttribute("displayNameSharers");
            constructor.MultipleResultAction = MultipleResultAction.UseAll;
            constructor.QueryGroup           = new DBQueryGroup()
            {
                Operator = GroupOperator.All
            };
            constructor.QueryGroup.DBQueries.Add(new DBQueryByValue(ActiveConfig.DB.GetAttribute("displayName"), ValueOperator.Equals, ActiveConfig.DB.GetAttribute("displayName")));

            Guid object1Id = Guid.NewGuid();
            Guid object2Id = Guid.NewGuid();
            Guid object3Id = Guid.NewGuid();
            AcmaSchemaObjectClass objectClass = ActiveConfig.DB.GetObjectClass("person");

            try
            {
                MAObjectHologram object1 = ActiveConfig.DB.CreateMAObject(object1Id, "person");
                object1.SetAttributeValue(ActiveConfig.DB.GetAttribute("displayName"), "My Display Name");
                object1.CommitCSEntryChange();

                MAObjectHologram object2 = ActiveConfig.DB.CreateMAObject(object2Id, "person");
                object2.SetAttributeValue(ActiveConfig.DB.GetAttribute("displayName"), "My Display Name");
                object2.CommitCSEntryChange();

                MAObjectHologram object3 = ActiveConfig.DB.CreateMAObject(object3Id, "person");
                object3.SetAttributeValue(ActiveConfig.DB.GetAttribute("displayName"), "My Display Name");
                constructor.Execute(object3);
                object3.CommitCSEntryChange();

                object3 = ActiveConfig.DB.GetMAObject(object3Id, objectClass);
                AttributeValues values = object3.GetMVAttributeValues(ActiveConfig.DB.GetAttribute("displayNameSharers"));

                if (values.IsEmptyOrNull)
                {
                    Assert.Fail("The constructor did not create any results");
                }

                if (!values.ContainsAllElements(new List <object> {
                    object1Id, object2Id
                }))
                {
                    Assert.Fail("The constructor did not create the correct values");
                }
            }
            finally
            {
                ActiveConfig.DB.DeleteMAObjectPermanent(object1Id);
                ActiveConfig.DB.DeleteMAObjectPermanent(object2Id);
                ActiveConfig.DB.DeleteMAObjectPermanent(object3Id);
            }
        }
Esempio n. 28
0
        /*
         * Developer: Hamza Haq
         * Date: 9-23-19
         * Action: getting AttributeValues by id from database
         * Input: int id
         * output: AttributeValues
         */
        public async Task <bool> DeleteById(int id)
        {
            using (IDbConnection conn = Connection)
            {
                AttributeValues _attributeValues = new AttributeValues();
                _attributeValues.value_id = id;
                var result = await conn.DeleteAsync <AttributeValues>(_attributeValues);

                return(result);
            }
        }
Esempio n. 29
0
        public ActionResult Create(AttributeValues attributeValues)
        {
            if (ModelState.IsValid)
            {
                db.AttributeValues.Add(attributeValues);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.AttributeId = new SelectList(db.Attributes, "Id", "Name", attributeValues.AttributeId);
            return(View(attributeValues));
        }
Esempio n. 30
0
        public AttributeValues getExchangeRateFromBooking(string FromCurrencyId, string ToCurrencyId, string BookingNumber)
        {
            var result = new AttributeValues();

            try
            {
                if (!string.IsNullOrEmpty(FromCurrencyId) && !string.IsNullOrEmpty(ToCurrencyId))
                {
                    var ExchangeRateDetailList = _MongoContext.Bookings.AsQueryable().Where(a => a.BookingNumber == BookingNumber).Select(b => b.ExchangeRateSnapshot.ExchangeRateDetail).FirstOrDefault();

                    if (ExchangeRateDetailList == null || ExchangeRateDetailList?.Count == 0)
                    {
                        var BaseCurrency = _MongoContext.mExchangeRate.AsQueryable().Where(a => a.DateMin <= DateTime.Now && DateTime.Now <= a.DateMax).Select(a => new ExchangeRateSnapshot
                        {
                            Currency_Id     = a.Currency_Id,
                            REFCUR          = a.RefCur,
                            ExchangeRate_id = a.ExchangeRateId,
                            DATEMAX         = a.DateMax,
                            DATEMIN         = a.DateMin,
                            EXRATE          = a.ExRate,
                            VATRATE         = a.VatRate,
                            CREA_DT         = a.CreateDate
                        }).FirstOrDefault();

                        ExchangeRateDetailList = _MongoContext.mExchangeRateDetail.AsQueryable().Where(a => a.ExchangeRate_Id == BaseCurrency.ExchangeRate_id)
                                                 .Select(a => new ExchangeRateDetailSnapshot
                        {
                            ExchangeRateDetail_Id = a.ExchangeRateDetail_Id,
                            Currency_Id           = a.Currency_Id,
                            CURRENCY = a.CURRENCY,
                            RATE     = a.RATE,
                            ROUNDTO  = a.ROUNDTO
                        }).ToList();
                    }

                    var FromCurrencyRate = ExchangeRateDetailList?.Where(a => a.Currency_Id == FromCurrencyId.ToLower()).FirstOrDefault();

                    var ToCurrencyRate = ExchangeRateDetailList?.Where(a => a.Currency_Id == ToCurrencyId.ToLower()).FirstOrDefault();

                    if (!(FromCurrencyRate == null || ToCurrencyRate == null))
                    {
                        result.Value = Convert.ToString(ToCurrencyRate.RATE / FromCurrencyRate.RATE);

                        result.AttributeValue_Id = ToCurrencyRate.ExchangeRateDetail_Id;
                    }
                }
                return(result);
            }
            catch (Exception e)
            {
                return(null);
            }
        }