Esempio n. 1
0
        private void buttonWorkModSave_Click(object sender, EventArgs e)
        {
            FrmDailyAdd form2 = new FrmDailyAdd();

            ModWork();
            AddListView();
        }
Esempio n. 2
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();
        }
Esempio n. 3
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();
        }
Esempio n. 4
0
        public void SearchWork()
        {
            if (form1.listViewWorkList.Items.Count > 0)
            {
                form1.listViewWorkList.Items.Clear();
            }
            FrmDailyAdd         form2    = new FrmDailyAdd();
            int                 i        = 0;
            List <WorkCategory> worklist = SearchLoad();

            form1.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));

                form1.listViewWorkList.Items.Add(item);
                i++;
            }
            form1.listViewWorkList.EndUpdate();
            if (form1.listViewWorkList.Items.Count == 0)
            {
                MessageBox.Show("검색결과가 없습니다.");
            }
            else
            {
                this.Close();
            }
        }
Esempio n. 5
0
        public void ModWork()
        {
            FrmDailyAdd form2    = new FrmDailyAdd();
            int         indexnum = Convert.ToInt32(form1.listViewWorkList.FocusedItem.Text);

            string maincategory   = comboBoxMainCateMod.Text;
            string middlecategory = comboBoxMiddleCateMod.Text;
            string subcategory    = comboBoxSubCateMod.Text;

            int main_id   = 0;
            int middle_id = 0;
            int sub_id    = 0;

            string          query_id = "SELECT id, maincategory_id, middlecategory_id FROM SubCategory WHERE name = '" + comboBoxSubCateMod.Text + "'";
            MySqlDataReader rdr      = DailyTaskDBManager.GetInstace().Select(query_id);

            while (rdr.Read())
            {
                main_id   = (int)rdr["maincategory_id"];
                middle_id = (int)rdr["middlecategory_id"];
                sub_id    = (int)rdr["id"];
            }
            rdr.Close();

            string query = "UPDATE Task SET Task_maincategory_id = @main_id, Task_middlecategory_id = " +
                           "@middle_id, Task_subcategory_id = @sub_id WHERE id='" + indexnum + "'";

            if (maincategory == "대분류" || middlecategory == "중분류" || subcategory == "소분류")
            {
                MessageBox.Show("항목을 수정해 주세요");
            }
            else
            {
                DailyTaskDBManager.GetInstace().Update(query, main_id, middle_id, sub_id);
                this.Close();
            }
        }
Esempio n. 6
0
        private void buttonWorkDel_Click(object sender, EventArgs e)
        {
            FrmDailyAdd form2    = new FrmDailyAdd();
            int         indexnum = 0;

            if (listViewWorkList.SelectedIndices.Count == 0)
            {
                MessageBox.Show("항목을 선택해 주세요");
            }
            else
            {
                if (MessageBox.Show("선택하신 업무가 삭제됩니다", "업무 삭제", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    indexnum = Convert.ToInt32(listViewWorkList.FocusedItem.Text);
                    string query = "DELETE FROM Task WHERE id = '" + indexnum + "'";
                    DailyTaskDBManager.GetInstace().DBquery(query);
                    DelList(indexnum);
                }
                else
                {
                    MessageBox.Show("삭제를 취소하셨습니다.");
                }
            }
        }
Esempio n. 7
0
        private void buttonWorkReg_Click(object sender, EventArgs e)
        {
            FrmDailyAdd form2 = new FrmDailyAdd(this);

            form2.Show();
        }