Ejemplo n.º 1
0
 private void btnNew_Click(object sender, EventArgs e)
 {
     AddTaskForm FormTask = new AddTaskForm();
     FormTask.TopMost = true;
     FormTask.StartPosition = FormStartPosition.CenterScreen;
     FormTask.Show();
     FormTask.addComplete += FormTask_addComplete;
 }
Ejemplo n.º 2
0
        private void dtDotask_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            DataTable dt = this.dtDotask.DataSource as DataTable;
            if (dt.Rows.Count == 0) return;

            string buttonText = this.dtDotask.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
            if (buttonText == "更新进度")
            {
                string orderNumber = this.dtDotask.Rows[e.RowIndex].Cells["任务序号"].Value.ToString();

                string taskName = this.dtDotask.Rows[e.RowIndex].Cells["任务名称"].Value.ToString();
                string dtStart = this.dtDotask.Rows[e.RowIndex].Cells["开始时间"].Value.ToString();
                string dtEnd = this.dtDotask.Rows[e.RowIndex].Cells["结束时间"].Value.ToString();
                string progresss = this.dtDotask.Rows[e.RowIndex].Cells["进度"].Value.ToString();

                TaskClass task = new TaskClass();
                task.orderNumber = int.Parse(orderNumber);
                task.taskName = taskName;
                task.dtStart = DateTime.Parse(dtStart);
                task.dtEnd = DateTime.Parse(dtEnd);
                task.progresss = double.Parse(progresss);

                AddTaskForm FormTask = new AddTaskForm();
                FormTask.NewTask = task;
                FormTask.TopMost = true;
                FormTask.StartPosition = FormStartPosition.CenterScreen;
                FormTask.Show();
                FormTask.addComplete += FormTask_addComplete;
            }
            if (buttonText == "删除")
            {
                string orderNumber = this.dtDotask.Rows[e.RowIndex].Cells["任务序号"].Value.ToString();
                string taskName = this.dtDotask.Rows[e.RowIndex].Cells["任务名称"].Value.ToString();

                TaskClass task = new TaskClass();
                task.orderNumber = int.Parse(orderNumber);
                task.taskName = taskName;
                if (MessageBox.Show("确定删除任务: " + taskName+" ?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    TaskDBHelper.DeleteTask(task);
                    loadData();
                }
            }
        }