コード例 #1
0
ファイル: Form1.cs プロジェクト: krkkng/standby-list-creator
        private void ShowfreeCommentForm(ScheduleLabel schedulelabel)
        {
            FormComment form   = new FormComment();
            Person      person = null;

            if (schedulelabel.Schedule.Item != null)
            {
                person = schedulelabel.Schedule.Item as Person;
            }
            StandbyList.StandbyList st = Core.StandbyLists.FirstOrDefault(t => t.Year == calendar1.DrawYear && t.Month == calendar1.DrawMonth);
            if (st == null)
            {
                return;
            }
            int day = schedulelabel.Schedule.Start.Day;

            if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                if (form.Person != null)
                {
                    st.Standby.SetDuty(day, form.Person);
                    schedulelabel.Schedule.Item = form.Person;
                }
                ShowAgrregationForm();
            }
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: krkkng/Taikihyou
        private void ShowfreeCommentForm(ScheduleLabel schedulelabel)
        {
            FormComment form = new FormComment();

            StandbyList.StandbyList.StandbyPosition pos;
            Person person = null;

            if (schedulelabel.Schedule.Item != null)
            {
                person = schedulelabel.Schedule.Item as Person;
            }
            if (schedulelabel.Schedule.Description == "1st")
            {
                pos = StandbyList.StandbyList.StandbyPosition.First;
            }
            else if (schedulelabel.Schedule.Description == "2nd")
            {
                pos = StandbyList.StandbyList.StandbyPosition.Second;
            }
            else if (schedulelabel.Schedule.Description == "3rd")
            {
                pos = StandbyList.StandbyList.StandbyPosition.Third;
            }
            else
            {
                pos = StandbyList.StandbyList.StandbyPosition.PCI;
            }
            StandbyList.StandbyList st = Core.StandbyLists.FirstOrDefault(t => t.Year == calendar1.DrawYear && t.Month == calendar1.DrawMonth);
            if (st == null)
            {
                return;
            }
            int day = schedulelabel.Schedule.Start.Day - 1;

            if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                if (form.Person != null)
                {
                    if (pos == StandbyList.StandbyList.StandbyPosition.First)
                    {
                        if (person != null)
                        {
                            person.FirstCounter--;
                            if (CalendarControl.GenCalendar.HolidayChecker.IsHoliday(schedulelabel.Schedule.Start))
                            {
                                person.HolidayCounter--;
                            }
                        }
                        st.Standby[day].First       = form.Person;
                        schedulelabel.Schedule.Item = form.Person;
                    }
                    else if (pos == StandbyList.StandbyList.StandbyPosition.Second)
                    {
                        if (person != null)
                        {
                            person.SecondCounter--;
                            if (CalendarControl.GenCalendar.HolidayChecker.IsHoliday(schedulelabel.Schedule.Start))
                            {
                                person.SecondHolidayCounter--;
                            }
                        }
                        st.Standby[day].Second      = form.Person;
                        schedulelabel.Schedule.Item = form.Person;
                    }
                    else if (pos == StandbyList.StandbyList.StandbyPosition.Third)
                    {
                        if (person != null)
                        {
                            person.ThirdCounter--;
                            if (CalendarControl.GenCalendar.HolidayChecker.IsHoliday(schedulelabel.Schedule.Start))
                            {
                                person.ThirdHolidayCounter--;
                            }
                        }
                        st.Standby[day].Third       = form.Person;
                        schedulelabel.Schedule.Item = form.Person;
                    }
                    else if (pos == StandbyList.StandbyList.StandbyPosition.PCI)
                    {
                        if (person != null)
                        {
                            person.PCICounter--;
                            if (CalendarControl.GenCalendar.HolidayChecker.IsHoliday(schedulelabel.Schedule.Start))
                            {
                                person.PCIHolidayCounter--;
                            }
                        }
                        st.Standby[day].PCI         = form.Person;
                        schedulelabel.Schedule.Item = form.Person;
                    }
                }
                PersonsAggregation();
            }
        }