Exemple #1
0
        private void LoadCurTimetable()
        {
            DateTime date = dateTimePicker1.Value;

            if (date < mTb.StartTime || date >= mTb.EndTime)
            {
                mTb.ReadTimetable(date, mCategory);
                tn      = new TreeNode(mTb.Timetable.Print());
                tn.Name = mTb.Timetable.Name;
                foreach (var itr in mTb.Timetable.Subs)
                {
                    LoadTimetableItemSubs(itr, tn);
                }
                treeView1.Nodes.Clear();
                treeView1.Nodes.Add(tn);
                treeView1.ExpandAll();

                ViewEventItem.InitCategoryCompare(mTb.Timetable);
            }

            mTb.Timetable.Clear();
            foreach (var ev in curEvs)
            {
                mTb.Timetable.Update(ev.Category, UltilityConvert.ToDoble(ev.Time), (double)24);
            }
            DisplayTimetable(mTb.Timetable, tn);
        }
Exemple #2
0
        public void Translate()
        {
            //Status
            if (!String.IsNullOrEmpty(this.Status))
            {
                int statusCode = Convert.ToInt32(UltilityConvert.ToDoble(this.Status));
                switch (statusCode)
                {
                case 0:
                    break;

                case 1:
                    this.Status = "OnProcess";
                    break;

                case 2:
                    this.Status = "Current";
                    break;

                case 3:
                    this.Status = "Finished";
                    break;

                case 4:
                    this.Status = "GiveUp";
                    break;

                case 6:
                    this.Status = "LookBack";
                    break;

                case 7:
                    this.Status = "Completed";
                    break;

                case 8:
                    this.Status = "Extra";
                    break;

                case 9:
                    this.Status = "Regular";
                    break;

                default:
                    this.Status = statusCode.ToString() + "%";
                    break;
                }
            }
        }
Exemple #3
0
        public void Save(List <InputEventItem> CurEvs, DateTime CurDate)
        {
            foreach (var itr in CurEvs)
            {
                DateTime date;
                if (itr.Date == null)
                {
                    date = CurDate;
                }
                else
                {
                    date = UltilityConvert.ToDate(itr.Date);
                }
                double time = UltilityConvert.ToDoble(itr.Time);
                if (String.IsNullOrEmpty(itr.Status))
                {
                    itr.Status = "Current";
                }
                //event exist check
                bool isFound   = false;
                bool mergeFlag = false;
                foreach (var ev in this.Items)
                {
                    if (ev.Name == itr.Name)
                    {
                        if (String.IsNullOrEmpty(ev.Category))
                        {
                            ev.Category = itr.Category;
                            mergeFlag   = true;
                        }
                        if (ev.Category != itr.Category)
                        {
                            continue;
                        }

                        isFound = true;
                        if (ev.Status != itr.Status)
                        {
                            ev.Status = itr.Status;
                        }
                        bool isFoundItem = false;
                        foreach (var item in ev.Items)
                        {
                            if (item.Date == date)
                            {
                                isFoundItem = true;
                                if (time == -1.0)
                                {
                                    ev.Items.Remove(item);
                                    break;
                                }
                                else
                                {
                                    item.Time = time;
                                    item.Memo = itr.Memo;
                                }
                            }
                        }
                        if (!isFoundItem && time != 0.0)
                        {
                            ev.Items.Add(new EventItem(itr, CurDate));
                            ev.Items.Sort();
                        }
                        else
                        {
                            if (ev.Items.Count == 0)
                            {
                                this.Items.Remove(ev);
                            }
                        }
                        break;
                    }
                }
                if (mergeFlag)
                {
                    Event first     = null;
                    bool  firstFlag = true;
                    foreach (var ev in this.Items)
                    {
                        if (ev.Name == itr.Name)
                        {
                            if (firstFlag)
                            {
                                first     = ev;
                                firstFlag = false;
                            }
                            else
                            {
                                if (String.IsNullOrEmpty(ev.Category) || ev.Category == first.Category)
                                {
                                    foreach (var item in ev.Items)
                                    {
                                        first.Items.Add(new EventItem(item));
                                    }
                                    first.Items.Sort();
                                    Items.Remove(ev);
                                    break;
                                }
                            }
                        }
                    }
                }
                if (!isFound && time != 0.0)
                {
                    Event newEv = new Event(itr, CurDate);
                    this.Items.Add(newEv);
                }
            }
            this.Save();
        }
Exemple #4
0
 public EventItem(InputEventItem InEv, DateTime CurDate)
 {
     this.Date = CurDate;
     this.Time = UltilityConvert.ToDoble(InEv.Time);
     this.Memo = InEv.Memo;
 }
Exemple #5
0
        public void Translate()
        {
            //Status
            if (!String.IsNullOrEmpty(this.Status))
            {
                int statusCode = Convert.ToInt32(UltilityConvert.ToDoble(this.Status));
                switch (statusCode)
                {
                case 0:
                    break;

                case 1:
                    this.Status = "OnProcess";
                    break;

                case 2:
                    this.Status = "Current";
                    break;

                case 3:
                    this.Status = "Finished";
                    break;

                case 4:
                    this.Status = "GiveUp";
                    break;

                case 6:
                    this.Status = "LookBack";
                    break;

                case 7:
                    this.Status = "Completed";
                    break;

                case 8:
                    this.Status = "Extra";
                    break;

                case 9:
                    this.Status = "Regular";
                    break;

                default:
                    this.Status = statusCode.ToString() + "%";
                    break;
                }
            }

            //Time
            string s    = this.Time;
            double time = 0.0;
            double cnt  = 1;

            if (s.Length == 2)
            {
                cnt = UltilityConvert.ToDoble(s.Substring(0, 1));
                s   = s.Substring(1, 1);
            }
            if (s == "h" || s == "H")
            {
                time = 0.5 * cnt;
            }
            else if (s == "q" || s == "Q")
            {
                time = 0.25 * cnt;
            }
            else if (s == "t" || s == "T")
            {
                time = 0.1 * cnt;
            }
            if (time != 0.0)
            {
                this.Time = time.ToString();
            }
        }