示例#1
0
        private void ageReportAreaListView_MouseClick(object sender, MouseEventArgs e)
        {
            ListViewHitTestInfo HI = ageReportAreaListView.HitTest(e.Location);

            List <AreaInfo> areas = MongoCRUD.GetInstance().LoadRecords <AreaInfo>("Areas", "areaName", HI.Item.Text);

            if (areas.Count != 0)
            {
                ageReportMainListView.Items.Clear();

                foreach (LocationObject loc in areas[0].locationsList)
                {
                    foreach (CaseInfo ci in loc.casesList)
                    {
                        DateTime dt = DateTime.Parse(ci.ageInfo);

                        ListViewItem item = new ListViewItem(ci.ageInfo);
                        item.SubItems.Add(ci.caseID);
                        AgeInfo cai = CalculateAgeInfo(dt, MongoCRUD.GetInstance().GetServerTime());
                        item.SubItems.Add("Days: " + cai.days + "  Hours: " + cai.hours + "  Min: " + cai.minute);
                        item.SubItems.Add(ci.curLoc);

                        ageReportMainListView.Items.Add(item);
                    }
                }
            }
        }
示例#2
0
        private AgeInfo CalculateAgeInfo(DateTime startDT, DateTime endDT)
        {
            AgeInfo  ai        = new AgeInfo();
            DateTime currentDT = DateTime.UtcNow.Date;
            int      days      = (endDT - startDT).Days;
            int      hours     = (endDT - startDT).Hours;
            int      min       = (endDT - startDT).Minutes;

            ai.days   = days;
            ai.hours  = hours;
            ai.minute = min;

            return(ai);
        }