示例#1
0
            public override DataInterface LoadAssembly(string name)
            {
                var flr = f.LoadFile(name);

                if (flr == null)
                {
                    return(null);
                }

                // Load to an array interface (access is quicker than
                //  constantly searching the stream)
                var s = flr.Stream;

                s.Seek(0, SeekOrigin.Begin);
                var l = s.Length;

                var arr = new byte[l];

                s.Read(arr, 0, (int)l);

                var ret = new ArrayInterface(arr);

                ret.Name = flr.FullFilename;

                return(ret);
            }
示例#2
0
        public OfficeHoursHandler(
            DateTime now,             // UTC time
            string officeStartTimeCfg,
            string officeEndTimeCfg,
            // ReSharper disable once UnusedParameter.Local
            string weekendCfg             // Currently not used. Weekend is always Saturday & Sunday.
            )
        {
            Current = new CurrentValues(this);

            this.now = now;

            // Looks like .net knows when Summer time starts and ends so specifying GMT Standard Time
            // is enough, i.e. no need to calculate current offset from UTC--.net does this.
            //
            // Example 1:
            //     TimeZoneInfo londonTimeZone = TimeZoneInfo.FindSystemTimeZoneById("GMT Standard Time");
            //     DateTime now = new DateTime(2015, 12, 6, 13, 0, 0, DateTimeKind.Utc);
            //     DateTime localNow = TimeZoneInfo.ConvertTimeFromUtc(now, londonTimeZone);
            //     Console.WriteLine("local now: {0}", localNow.ToString("yyyy-MM-dd HH:mm:ss"));
            //  Prints: 2015-12-06 13:00:00
            //
            // Example 2:
            //     TimeZoneInfo londonTimeZone = TimeZoneInfo.FindSystemTimeZoneById("GMT Standard Time");
            //     DateTime now = new DateTime(2015, 7, 6, 13, 0, 0, DateTimeKind.Utc);
            //     DateTime localNow = TimeZoneInfo.ConvertTimeFromUtc(now, londonTimeZone);
            //     Console.WriteLine("local now: {0}", localNow.ToString("yyyy-MM-dd HH:mm:ss"));
            //  Prints: 2015-07-06 14:00:00

            TimeZoneInfo londonTimeZone = TimeZoneInfo.FindSystemTimeZoneById("GMT Standard Time");

            this.localNow  = TimeZoneInfo.ConvertTimeFromUtc(now, londonTimeZone);
            this.startTime = ParseConfiguredTime(this.localNow, officeStartTimeCfg, 9, 0);
            this.endTime   = ParseConfiguredTime(this.localNow, officeEndTimeCfg, 19, 0);

            // Index of array is a distance from now in days.
            // I.e. approvalCount[0] is approval count for today, openLoanAmount[1] is open loan amount for yesterday, etc.
            //                                                     0  1  2  3  4  5  6
            ApprovalCount  = new ArrayInterface <int>(new [] { 0, 0, 0, 0, 0, 0, 0, });
            OpenLoanAmount = new ArrayInterface <decimal>(new [] { 0m, 0, 0, 0, 0, 0, 0, });
        }         // constructor