Exemplo n.º 1
0
 private void btn_Save_Click(object sender, EventArgs e)
 {
     if (ClsTask.strTaskName != null)
     {
         FrmProjectModify frmProjcetModify = new FrmProjectModify();
         ClsTask.strTaskName   = txt_TaskName.Text;
         ClsTask.Disk          = txt_Disk.Text;
         ClsTask.StartPosition = txt_StartPosition.Text;
         ClsTask.Description   = txt_Description.Text;
         ClsTask.TaskID        = sqlMethod.ModifyTask(ClsTask);
         this.DialogResult     = DialogResult.OK;
         MessageBox.Show("任务修改完成!");
         //frmProjcetModify.DialogResult = DialogResult.OK;
         this.DialogResult = DialogResult.OK;
         this.Close();
     }
     else
     {
         if (txt_TaskName.Text == "")
         {
             MessageBox.Show("请输入任务名称!");
         }
         else
         {
             curTask.ProjectID     = ClsTask.ProjectID;
             curTask.strTaskName   = txt_TaskName.Text;
             curTask.Disk          = txt_Disk.Text;
             curTask.StartPosition = txt_StartPosition.Text;
             curTask.Description   = txt_Description.Text;
             string info = Info();
             if (info != "")
             {
                 MessageBox.Show(info);
                 return;
             }
             sqlMethod.AddTask(curTask);
             this.Close();
             MessageBox.Show("任务新建完成!");
             this.DialogResult = DialogResult.OK;
         }
     }
 }
Exemplo n.º 2
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)
     { }
 }