private void saveButton(object sender, EventArgs e)
 {
     if (isValid())
     {
         if (Project == null)
         {
             Project = new InvestProject();
         }
         Project.nameProject = textBoxNameStage.Text;
         Project.numberProject = textBoxNumberProject.Text;
         Project.dateBegin = dateBeginPlan.Value;
         Project.dateEnd = dateEndPlan.Value;
         Project.dateBeginProg = dateBeginProg.Value;
         Project.dateEndProg = dateEndProg.Value;
         UserDAO daoUser = new UserDAO();
         DepartmentDAO daoDepartment = new DepartmentDAO();
         InvestProjectDAO projectDAO = new InvestProjectDAO();
         Project.user = daoUser.getById(Convert.ToInt32(((KeyValuePair)comboBoxUser.SelectedItem).Key));
         Project.department = daoDepartment.getById(Convert.ToInt32(((KeyValuePair)comboBoxDepartment.SelectedItem).Key));
         
         if (Project.idProject != 0)
         {
             projectDAO.update(Project);
         }
         else
         {
             projectDAO.insert(Project);
         }
         this.Close();
     }
 }
        public void setProject(InvestProject editProject)
        {
            Project = editProject;
            if (Project != null)
            {
                textBoxNameStage.Text = Project.nameProject;
                textBoxNumberProject.Text = Project.numberProject;
                dateBeginPlan.Value = Project.dateBegin;
                dateEndPlan.Value = Project.dateEnd;
                dateBeginProg.Value = Project.dateBeginProg;
                dateEndProg.Value = Project.dateEndProg;
                textBoxAbout.Text = Project.aboutProject;
                comboBoxDepartment.SelectedItem = new KeyValuePair(Project.department.idDepartment.ToString(), Project.department.nameDepartment);
                comboBoxUser.SelectedItem = new KeyValuePair(Project.user.Id.ToString(), Project.user.FullName);

            }
        }