Example #1
0
        public AppStaticDTO StaticData()
        {
            AppStaticDTO dto = new AppStaticDTO();

            #region Regular Expressions
            var dbRegularExpressions = TanService.GetRegulerExpressions();
            foreach (var rex in dbRegularExpressions)
            {
                dto.RegulerExpressions.Add(new RegulerExpressionDTO
                {
                    Expression           = rex.Expression,
                    Id                   = rex.Id,
                    RegulerExpressionFor = rex.RegulerExpressionFor
                });
            }
            #endregion

            var boilingPoints = TanService.GetSolventBoilingPoints();
            foreach (var bp in boilingPoints)
            {
                dto.SolventBoilingPoints.Add(new SolventBoilingPointDTO
                {
                    DegreesBoilingPoint    = bp.DegreesBoilingPoint,
                    fahrenheitBoilingPoint = bp.fahrenheitBoilingPoint,
                    Id = bp.Id,
                    KelvinBoilingPoint = bp.KelvinBoilingPoint,
                    Name = bp.Name,
                    RankineBoilingPoint = bp.RankineBoilingPoint,
                    RegNo = bp.RegNo
                });
            }
            var cvts      = TanService.GetCVTs();
            var freetexts = TanService.GetFreetexts();
            dto.CommentDictionary.CVTs      = cvts;
            dto.CommentDictionary.Freetexts = freetexts;
            dto.NamePriorities = TanService.GetNamePriorities();
            return(dto);
        }
Example #2
0
        public static async Task GetStaticData()
        {
            try
            {
                regularExpressions.Clear();
                solventBoilingPoints.Clear();
                NamePriorities.Clear();

                RestStatus status = await RestHub.GetStaticData();

                if (status.UserObject != null)
                {
                    AppStaticDTO dto = (AppStaticDTO)status.UserObject;
                    regularExpressions.AddRange(dto.RegulerExpressions);
                    solventBoilingPoints.AddRange(dto.SolventBoilingPoints.OrderBy(sbp => sbp.Name).ToList());

                    commentDictionary.FreeText.Clear();
                    commentDictionary.CVT.Clear();

                    commentDictionary.FreeText = new List <FreeText>();
                    commentDictionary.FreeText = dto.CommentDictionary.Freetexts;

                    commentDictionary.CVT = new List <CVT>();
                    commentDictionary.CVT = dto.CommentDictionary.CVTs;
                    NamePriorities.AddRange(dto.NamePriorities);
                }
                else
                {
                    AppErrorBox.ShowErrorMessage("Unable to fetch initial data . .", status.StatusMessage);
                }
            }
            catch (Exception ex)
            {
                Log.This(ex);
            }
        }