Пример #1
0
        private void buttonLoadWorkList_Click(object sender, EventArgs e)
        {
            FrmDailyAdd         form2    = new FrmDailyAdd();
            int                 i        = 0;
            List <WorkCategory> worklist = form2.LoadWork();

            if (listViewWorkList.Items.Count > 0)
            {
                listViewWorkList.Items.Clear();
            }
            listViewWorkList.BeginUpdate();
            ListViewItem item;

            while (i < worklist.Count)
            {
                WorkCategory workcategory = new WorkCategory();
                workcategory = worklist[i];
                item         = new ListViewItem(Convert.ToString(workcategory.id));
                item.SubItems.Add(Convert.ToString(workcategory.day.ToString("yyyy-MM-dd")));
                item.SubItems.Add(workcategory.start_time);
                item.SubItems.Add(workcategory.end_time);
                item.SubItems.Add(AddTaskName(workcategory.maindcategory_id, 1));
                item.SubItems.Add(AddTaskName(workcategory.middlecategory_id, 2));
                item.SubItems.Add(AddTaskName(workcategory.subcategory_id, 3));

                listViewWorkList.Items.Add(item);
                i++;
            }
            listViewWorkList.EndUpdate();
        }
Пример #2
0
        public void AddListView()
        {
            FrmDailyAdd form2 = new FrmDailyAdd();

            if (form1.listViewWorkList.Items.Count > 0)//listview에 아이템 있으면 지우고 로드
            {
                form1.listViewWorkList.Items.Clear();
            }
            List <WorkCategory> worklist = form2.LoadWork();

            form1.listViewWorkList.BeginUpdate();
            ListViewItem item;
            int          i = 0;

            while (i < worklist.Count)//listview에 삽입
            {
                WorkCategory workcategory = new WorkCategory();
                workcategory = worklist[i];
                item         = new ListViewItem(Convert.ToString(workcategory.id));
                item.SubItems.Add(Convert.ToString(workcategory.day.ToString("yyyy-MM-dd")));
                item.SubItems.Add(workcategory.start_time);
                item.SubItems.Add(workcategory.end_time);
                item.SubItems.Add(AddTaskName(workcategory.maindcategory_id, 1));
                item.SubItems.Add(AddTaskName(workcategory.middlecategory_id, 2));
                item.SubItems.Add(AddTaskName(workcategory.subcategory_id, 3));

                form1.listViewWorkList.Items.Add(item);

                i++;
            }
            form1.listViewWorkList.EndUpdate();
        }