Esempio n. 1
0
        public DisplayCounterRecords GetLatestCounterRecord(string path, string name, string group = null, int count = 30)
        {
            string me = whoami();

            if (string.IsNullOrEmpty(group))
            {
                group = MembershipHelper.DefaultGroup(me);
            }
            else
            {
                MembershipHelper.CheckMembership(group, me);
            }

            CounterSet counterSet = _counterManager.GetCounterSet(group, name);

            if (counterSet == null)
            {
                throw new CounterSetNotFoundException();
            }

            int start = counterSet.RecordCount - count > 0 ? counterSet.RecordCount - count : 0;
            List <DisplayRecord> records = new List <DisplayRecord>();

            foreach (var record in _counterManager.GetCounterRecords(name, group, start))
            {
                DisplayRecord rec = new DisplayRecord(record.Key, CounterRecordHelper.GetValue(record, path));
                records.Add(rec);
            }

            return(new DisplayCounterRecords(name, group, path, start, records));
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            //DisplayDifferenceOverrideNew.Display();

            DisplayRecord.Display();
            //Console.WriteLine("Hello World!");
        }
Esempio n. 3
0
        public ContactItem searchUserByEmail(String email)
        {
            try
            {
                log.Debug("Searching email " + email);
                UserApi userApi = new UserApi(session.GetApiClient());

                ContactcardApi       contactCartApi = new ContactcardApi(session.GetApiClient());
                GetUserByEmailResult result         = userApi.GetUserByEmail(email);
                if (result.Hdr.Rc == 0)
                {
                    DisplayRecord displayRecord = result.DisplayRecord;
                    ContactItem   contactItem   = getContact(displayRecord.Key);
                    contactItem.Key  = displayRecord.Key;
                    contactItem.Link = session.OriginalHost + "/c/" + contactItem.Key;
                    return(contactItem);
                }
                else
                {
                    throw new Exception("Email " + email + " not found");
                }
            } catch (Exception ex)
            {
                throw new Exception("Email searching email " + email, ex);
            }
        }
        private void ViewRecordExecute()
        {
            DisplayRecord view = new DisplayRecord();

            view.DataContext = new DisplayRecordViewModel(view, SelectItem.ID);
            view.Owner       = mWindow;
            bool?result = view.ShowDialog();

            if (result == true)
            {
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Returns an array of strings after reading CSV files
        /// </summary>
        /// <param name="folderPath"></param>
        /// <param name="percentage"></param>
        /// <returns></returns>
        public IEnumerable <DisplayRecord> ReadCSVFiles(string folderPath, int percentage)
        {
            List <DisplayRecord>   displayRecordList = new List <DisplayRecord>();
            IEnumerable <string[]> lineArray         = new List <string[]>();
            DisplayRecord          displayRecord     = new DisplayRecord();

            try
            {
                // Take a snapshot of the file system.
                DirectoryInfo dir = new DirectoryInfo(folderPath);

                // This method assumes that the application has discovery permissions
                // for all folders under the specified path.
                IEnumerable <FileInfo> fileList = dir.GetFiles("*.csv", SearchOption.AllDirectories);


                foreach (var fileInfo in fileList)
                {
                    // Read the file
                    lineArray = File.ReadLines(fileInfo.FullName)
                                .Select(a => a.Split(';'))
                                .SelectMany(lines => lines)
                                .Select(l => l.Split(','));

                    // Note: Both LP and TOU files Date/Time and Data Value / Energy column indexes are the same
                    // But following logic is used assuming that column indexes differ in two files.
                    if (fileInfo.Name.StartsWith("LP", System.StringComparison.OrdinalIgnoreCase))
                    {
                        // Get DataValueIndex = 5 & DateTime index = 3
                        displayRecord = GetRecords(lineArray, fileInfo.Name, percentage, LPDateTimeIndex, LPValueIndex);
                    }
                    else
                    {
                        // Get EnergyIndex = 5 & DateTime index = 3
                        displayRecord = GetRecords(lineArray, fileInfo.Name, percentage, TOUDateTimeIndex, TOUValueIndex);
                    }

                    displayRecordList.Add(displayRecord);
                }
            }
            catch (Exception e)
            {
                throw new Exception("Error reading the file", e);
            }

            return(displayRecordList);
        }
Esempio n. 6
0
        private void CalcAnAperture(DisplayRecord displayRecord)
        {
            IsVisibleHelper.Calc(displayRecord)
            .Then(() =>
            {
                MinApertureBestExitPupil.BkgndBrightEye = SkyBkgndBrightness;
                MinApertureBestExitPupil.ApparentFoV    = 100;

                MinApertureBestExitPupil.ObjMag       = IsVisibleHelper.ObjectMagnitude;
                MinApertureBestExitPupil.MaxObjArcmin = IsVisibleHelper.ObjectSize1;
                MinApertureBestExitPupil.MinObjArcmin = IsVisibleHelper.ObjectSize2;

                MinApertureBestExitPupil.Calc();
                (MinApertureBestExitPupil.MinimumApertureIn > 0)
                .Then(() => SetVisibleApertureDisplay(displayRecord));
            });
        }
Esempio n. 7
0
        private IEnumerable <DisplayRecord> GetDisplayRecords()
        {
            var record = new Contracts.Models.Record
            {
                Value    = "10.50",
                DateTime = "2019-04-21"
            };
            var recordList = new List <Contracts.Models.Record>();

            recordList.Add(record);
            var displayRecords = new DisplayRecord
            {
                Records  = recordList,
                FileName = "Test File Name.csv",
                Median   = 9.5
            };
            var displayRecordsList = new List <DisplayRecord>();

            displayRecordsList.Add(displayRecords);

            return(displayRecordsList);
        }
Esempio n. 8
0
        public DisplayCounterRecords GetCounterRecord(string path, string name, string group = null, int start = 0, int end = -1)
        {
            string me = whoami();

            if (string.IsNullOrEmpty(group))
            {
                group = MembershipHelper.DefaultGroup(me);
            }
            else
            {
                MembershipHelper.CheckMembership(group, me);
            }

            List <DisplayRecord> records = new List <DisplayRecord>();

            foreach (var record in _counterManager.GetCounterRecords(name, group, start, end))
            {
                DisplayRecord rec = new DisplayRecord(record.Key, CounterRecordHelper.GetValue(record, path));
                records.Add(rec);
            }

            return(new DisplayCounterRecords(name, group, path, start, records));
        }
Esempio n. 9
0
        public bool Calc(DisplayRecord dr)
        {
            double objMag;

            ValidData.Magnitude      = double.TryParse(dr.Magnitude, out objMag);
            ValidData.MagnitudeRange = objMag < 20;

            var majorAxisSize = GetSizeValue(dr.MajorAxisSize);

            ValidData.MajorSize = !double.IsNaN(majorAxisSize);

            var minorAxisSize = GetSizeValue(dr.MinorAxisSize);

            ValidData.MinorSize = !double.IsNaN(minorAxisSize);

            return(ValidData.IsValid().Then(() =>
            {
                ObjectName = dr.Name;
                ObjectMagnitude = objMag;
                ObjectSize1 = majorAxisSize;
                ObjectSize2 = ValidData.MinorSize.Return(() => minorAxisSize,
                                                         () => majorAxisSize);
            }));
        }
Esempio n. 10
0
 private void SetVisibleApertureDisplay(DisplayRecord displayRecord)
 {
     displayRecord.MinimumAperture = MinApertureBestExitPupil.MinimumApertureIn;
     displayRecord.BestExitPupil   = MinApertureBestExitPupil.BestExitPupilmm;
 }