private bool CheckEndValueContainsValue(WorkProjectPrerioid wpp)
 {
     if (wpp.GetEndWorkHourHasValue() && wpp.GetEndWorkMinsHasValue())
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
        public WorkTimeWindow(WorkProjectPrerioid wpp)
        {
            InitializeComponent();
            FillAllHourListBox();

            calStartWork.SelectedDate = wpp.GetDate().Date;

            if (CheckStartValueContainsValue(wpp))
            {
                lbxStartHour.SelectedIndex = wpp.GetStartDate().Hour;
                int sm = wpp.GetStartDate().Minute;
                if (sm.Equals(0))
                {
                    lbxStartMinute.SelectedIndex = 0;
                }
                else if (sm.Equals(5))
                {
                    lbxStartMinute.SelectedIndex = 1;
                }
                else if (sm.Equals(10))
                {
                    lbxStartMinute.SelectedIndex = 2;
                }
                else if (sm.Equals(15))
                {
                    lbxStartMinute.SelectedIndex = 3;
                }
                else if (sm.Equals(20))
                {
                    lbxStartMinute.SelectedIndex = 4;
                }
                else if (sm.Equals(25))
                {
                    lbxStartMinute.SelectedIndex = 5;
                }
                else if (sm.Equals(30))
                {
                    lbxStartMinute.SelectedIndex = 6;
                }
                else if (sm.Equals(35))
                {
                    lbxStartMinute.SelectedIndex = 7;
                }
                else if (sm.Equals(40))
                {
                    lbxStartMinute.SelectedIndex = 8;
                }
                else if (sm.Equals(45))
                {
                    lbxStartMinute.SelectedIndex = 9;
                }
                else if (sm.Equals(50))
                {
                    lbxStartMinute.SelectedIndex = 10;
                }
                else if (sm.Equals(55))
                {
                    lbxStartMinute.SelectedIndex = 11;
                }
            }

            if (CheckEndValueContainsValue(wpp))
            {
                lbxEndHour.SelectedIndex = wpp.GetEndDate().Hour;
                int em = wpp.GetEndDate().Minute;
                if (em.Equals(0))
                {
                    lbxEndMinute.SelectedIndex = 0;
                }
                else if (em.Equals(5))
                {
                    lbxEndMinute.SelectedIndex = 1;
                }
                else if (em.Equals(10))
                {
                    lbxEndMinute.SelectedIndex = 2;
                }
                else if (em.Equals(15))
                {
                    lbxEndMinute.SelectedIndex = 3;
                }
                else if (em.Equals(20))
                {
                    lbxEndMinute.SelectedIndex = 4;
                }
                else if (em.Equals(25))
                {
                    lbxEndMinute.SelectedIndex = 5;
                }
                else if (em.Equals(30))
                {
                    lbxEndMinute.SelectedIndex = 6;
                }
                else if (em.Equals(35))
                {
                    lbxEndMinute.SelectedIndex = 7;
                }
                else if (em.Equals(40))
                {
                    lbxEndMinute.SelectedIndex = 8;
                }
                else if (em.Equals(45))
                {
                    lbxEndMinute.SelectedIndex = 9;
                }
                else if (em.Equals(50))
                {
                    lbxEndMinute.SelectedIndex = 10;
                }
                else if (em.Equals(55))
                {
                    lbxEndMinute.SelectedIndex = 11;
                }
            }

            MakeWorkindTimeDescription();
        }