Exemplo n.º 1
0
        public void PickWorkStartTime()
        {
            Dictionary <StandardTime, List <int> > startTimes = new Dictionary <StandardTime, List <int> >();

            foreach (var day in DayRecords)
            {
                StandardTime sr   = day.Value.CloseTo();
                List <int>   days = new List <int>();
                if (startTimes.TryGetValue(sr, out days))
                {
                    days.Add(day.Key);
                }
                else
                {
                    startTimes[sr] = new List <int>()
                    {
                        day.Key
                    };
                }
            }
            int max = 0;

            foreach (var startTime in startTimes)
            {
                if (max < startTime.Value.Count)
                {
                    max            = startTime.Value.Count;
                    mWorkStartTime = startTime.Key;
                }
            }
        }
Exemplo n.º 2
0
        void GetStandardTimes()
        {
            this.mStandardTimes = new Dictionary <string, StandardTime>();

            XmlNodeList timeToWorkList = this.mXmlDoc.DocumentElement.SelectNodes("/recordchecker/timetowork/time");
            string      name           = string.Empty;
            int         hour           = 0;
            int         minute         = 0;
            int         second         = 0;

            foreach (var node in timeToWorkList)
            {
                XmlElement ele = node as XmlElement;
                name   = ele.GetAttribute("name");
                hour   = Convert.ToInt32(ele.GetAttribute("hour"));
                minute = Convert.ToInt32(ele.GetAttribute("minute"));
                second = Convert.ToInt32(ele.GetAttribute("second"));
                StandardTimes[name] = new StandardTime(new TimeSpan(hour, minute, second));
            }
        }
Exemplo n.º 3
0
 public void SetStandardRecord(StandardTime standardRecord)
 {
     this.mWorkStartTime = standardRecord;
     this.useElastic     = WhetherUseElastic();
 }