예제 #1
0
        private void btn_TaskDelete_Click(object sender, EventArgs e)
        {
            FrmTaskNew frmTaskNew = new FrmTaskNew();
            DataTable  dt;

            dt = ClsSQLMethod.SearchTask();
            DataGridViewRow item = dgvTaskList.CurrentRow;

            if (item == null)
            {
                return;
            }
            frmTaskNew.ClsTask.strTaskName = item.Cells[0].Value.ToString();
            frmTaskNew.ClsTask.TaskID      = (int)item.Tag;
            try
            {
                if (MessageBox.Show("确认删除任务:" + frmTaskNew.ClsTask.strTaskName + "?", "删除任务", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.OK)
                {
                    foreach (DataRow row in dt.Rows)
                    {
                        if (((int)item.Tag == int.Parse(row[0].ToString())))
                        {
                            break;
                        }
                    }
                    ClsSQLMethod.DeleteTask(frmTaskNew.ClsTask);
                    //this.DialogResult = DialogResult.OK;
                    LoadTaskInfo();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("删除失败!", "删除任务");
            }
        }
예제 #2
0
        private void btn_TaskBuild_Click(object sender, EventArgs e)
        {
            FrmTaskNew frmTaskNew = new FrmTaskNew();

            frmTaskNew.ClsTask.ProjectID = Convert.ToInt32(txt_projectID.Text);
            //frmTaskNew.ClsTask.ProjectName = txt_projectID.Text;
            DataGridViewRow item = dgvTaskList.CurrentRow;

            frmTaskNew.ShowDialog();
            //if (frmTaskNew.ShowDialog() == DialogResult.OK)
            //{
            //    this.DialogResult = DialogResult.OK;
            //}
            LoadTaskInfo();
        }
예제 #3
0
        private void FrmTaskMng_Load(object sender, EventArgs e)
        {
            FrmTaskNew frmTaskNew = new FrmTaskNew();

            txt_projectID.Text           = ClsTask.ProjectID.ToString();
            projectName                  = ClsTask.ProjectName;
            frmTaskNew.ClsTask.ProjectID = Convert.ToInt32(txt_projectID.Text);
            dgvTaskList.Rows.Clear();
            DataTable dt;

            dt = ClsSQLMethod.SearchTask();
            DataGridViewRow dgvRow;
            FrmTaskMng      frmTaskMng = new FrmTaskMng();

            curTask           = new ClsTask();
            curTask.ProjectID = frmTaskNew.ClsTask.ProjectID;

            foreach (DataRow row in dt.Rows)
            {
                if (row[1].ToString() == curTask.ProjectID.ToString())
                {
                    dgvRow = new DataGridViewRow();
                    dgvRow.CreateCells(dgvTaskList);
                    dgvRow.Cells[0].Value = row[2].ToString();
                    dgvRow.Cells[1].Value = row[3].ToString();
                    dgvRow.Cells[2].Value = row[4].ToString();
                    dgvRow.Cells[3].Value = row[5].ToString();
                    dgvRow.Tag            = row[0];
                    dgvTaskList.Rows.Add(dgvRow);
                }
            }
            //DataGridViewRow item = dgvTaskList.CurrentRow;
            //taskName = item.Cells[3].Value.ToString();
            if (dgvTaskList.CurrentRow != null)
            {
                dgvTaskList.CurrentRow.Selected = true;
            }
        }
예제 #4
0
        private void btn_TaskModify_Click(object sender, EventArgs e)
        {
            FrmTaskNew      frmTaskNew = new FrmTaskNew();
            DataGridViewRow item       = dgvTaskList.CurrentRow;

            if (item == null || item.Cells.Count == 0 || item.Cells[0].Value == null)
            {
                return;
            }
            frmTaskNew.ClsTask.ProjectID     = Convert.ToInt32(txt_projectID.Text);
            frmTaskNew.ClsTask.strTaskName   = item.Cells[0].Value.ToString();
            frmTaskNew.ClsTask.Disk          = item.Cells[1].Value.ToString();
            frmTaskNew.ClsTask.StartPosition = item.Cells[2].Value.ToString();
            frmTaskNew.ClsTask.Description   = item.Cells[3].Value.ToString();
            frmTaskNew.ClsTask.TaskID        = (int)item.Tag;
            frmTaskNew.StartPosition         = FormStartPosition.CenterScreen;
            frmTaskNew.ShowDialog();
            //if (frmTaskNew.ShowDialog() == DialogResult.OK)
            //{
            //    this.DialogResult = DialogResult.OK;
            //}
            LoadTaskInfo();
        }
예제 #5
0
 private void btnModify_Click(object sender, EventArgs e)
 {
     try
     {
         FrmProjectModify projectModify = new FrmProjectModify();
         FrmTaskNew       frmTaskNew    = new FrmTaskNew();
         DataGridViewRow  item          = dgvProjectList.CurrentRow;
         if (item == null || item.Cells.Count == 0 || item.Cells[0].Value == null)
         {
             return;
         }
         frmTaskNew.ClsTask.ProjectName       = item.Cells[0].Value.ToString();
         projectModify.Project.strProjectName = item.Cells[0].Value.ToString();
         if (item.Cells[2].Value != null)
         {
             projectModify.Project.strProjectBuilder = item.Cells[2].Value.ToString();
         }
         if (item.Cells[3].Value != null)
         {
             projectModify.Project.description = item.Cells[3].Value.ToString();
         }
         if (item.Tag != null)
         {
             projectModify.Project.intProjectID = (int)item.Tag;
         }
         projectModify.StartPosition = FormStartPosition.CenterScreen;
         projectModify.ShowDialog();
         //if (projectModify.ShowDialog() == DialogResult.OK)
         //{
         //    this.DialogResult = DialogResult.OK;
         //}
         LoadProjectInfo();
     }
     catch (Exception)
     { }
 }