コード例 #1
0
        private void openProjectMenuItem_Click(object sender, EventArgs e)
        {
            List <SQLFunc.SubResults> sqlData = mySQL.GetData(DBTables["Projects"].ToString(), "ProjectName,Country,Sector,SubSector,pCur,ProjectID");

            OpenProjects ProjectOpen = new OpenProjects(sqlData);

            ProjectOpen.ShowDialog();

            if (ProjectOpen == null || ProjectOpen.Data2LookFor == null)
            {
                return;
            }

            SQLFunc.SubResults sql1Data = mySQL.Get1Data(DBTables["Projects"].ToString(), "*", ProjectOpen.Data2LookFor);
            ProjectOpen.Close();

            switch (ProjectOpen.Action)
            {
            case OpenProjects.ActionType.OpenProject:
                NewMDEProject OpenProject = new NewMDEProject(DBTables, mySQL, today, sql1Data, CoinParams);
                OpenProject.ShowDialog();
                break;

            case OpenProjects.ActionType.ValidateProject:
                SQLFunc.SubResults checkData = mySQL.Get1Data(DBTables["ProjectInScope"].ToString(), "ProjectID", "ProjectID='" + sql1Data._SubResults[25].ToString() + "'");
                bool Exists = false;
                if (checkData._SubResults.Count != 0)
                {
                    Exists = true;
                }

                ProjectValidation ValidateProject = new ProjectValidation(DBTables, mySQL, sql1Data, today, Exists);
                ValidateProject.ShowDialog();

                if (ValidateProject == null)
                {
                    return;
                }

                if (ValidateProject.IsOpen)
                {
                    OpenProject = new NewMDEProject(DBTables, mySQL, today, sql1Data, CoinParams); OpenProject.ShowDialog();
                }

                if (ValidateProject.IsValidated)
                {
                    string data2save = "'" + ValidateProject.Project_ID.ToString() + "','Validated','" + FormatDate(ValidateProject.StartDate) + "','" + FormatDate(ValidateProject.COD) + "','" + FormatDate(ValidateProject.EndDate) + "','','','','','','','','','','','','',''";
                    mySQL.InsertData(DBTables["ProjectInScope"].ToString(), data2save);

                    UpdateProjectInScope();
                }

                ValidateProject.Close();
                break;
            }
        }