示例#1
0
        private void add_Click(object sender, EventArgs e)
        {
            Add addtask = new Add();

            addtask.ShowDialog();
            if (SystemConfig.New)
            {
                string t;
                if (SystemConfig.check)
                {
                    Task_listbox.Items.Add(SystemConfig.Task + "\t\t已完成");
                    t = "1";
                }
                else
                {
                    t = "0";
                    Task_listbox.Items.Add(SystemConfig.Task + "\t\t未完成");
                }
                int    x;
                string sql;
                sql = string.Format("insert into [{0}] (task, checked) VALUES ('{1}', '{2}')", SystemConfig.User, SystemConfig.Task, t);
                x   = AccessDB.ExecuteNonQuery(sql);
                //   sql = string.Format("insert into [Tip] ({0}, {1}Checked) VALUES ('-1', '-1')", SystemConfig.User, SystemConfig.User);
                // x = AccessDB.ExecuteNonQuery(sql);
            }
        }
示例#2
0
        private void edit_Click(object sender, EventArgs e)
        {
            string text = this.Task_listbox.SelectedItem.ToString();
            string ch;
            string text2;
            int    x;

            string[] str = text.Trim().Split('\t');
            ch    = str[2];
            text2 = str[0];
            Edit edit = new Edit(str[0], str[2]);

            edit.changed += new EventHandler(
                (sender1, e1) =>
                { text2 = edit.task;  ch = edit.check; }
                );
            edit.ShowDialog();
            if (ch != str[2] || text2 != str[0])
            {
                string sql = string.Format("update [{0}] set task = '{1}', checked = '{2}' where task = '{3}'",
                                           SystemConfig.User, text2, ((ch == "已完成")?1:0).ToString(), str[0]);
                x = AccessDB.ExecuteNonQuery(sql);
                Task_listbox.Items[this.Task_listbox.SelectedIndex] = text2 + "\t\t" + ch;
            }
        }
示例#3
0
        private void delete_Click(object sender, EventArgs e)
        {
            string text = this.Task_listbox.SelectedItem.ToString();
            int    x;
            int    t;

            string[] str = text.Trim().Split('\t');
            if (str[2] == "已完成")
            {
                t = 1;
            }
            else
            {
                t = 0;
            }
            string sql = string.Format("delete from [{0}] where task = '{1}'",
                                       SystemConfig.User, str[0]);

            x = AccessDB.ExecuteNonQuery(sql);
            Task_listbox.Items.Remove(Task_listbox.SelectedItem);
        }