private void createDocumentReview()
        {
            //populate so user can input necessary data
            DocumentDisplayForm ddf = new DocumentDisplayForm(df.createDocument(name, description, componentsList));
            if (ddf.ShowDialog() == DialogResult.OK)
            {
                //Serializes the newly created document. This should be added to each Wizard.
                TemplateStorage document = new TemplateStorage(name, version, description, componentsList);
                Serialization saveDocument = new Serialization();
                string output = saveDocument.serialize(document);

                String nextSqlText = "INSERT INTO Template (templateName, templateDescription, dateCreated, templateData, enabled) VALUES ('" + document.Name + "', '" + document.Description + "', '" + DateTime.Now.Date + "', '" + output + "', " + 1 + ");";
                DBCommand insertSqlCmd = DBConnection.makeCommand(nextSqlText);
                insertSqlCmd.RunNoReturnQuery();
                parentForm.refreshAll();
                this.Close();
            }
            else
            {
                this.componentsList.Clear();
            }
        }
Exemplo n.º 2
0
        private bool submitDataToDatabase()
        {
            String temp = docNameTextBox.Text.Trim();
            if (!checkDB(temp))
            {
                if (temp != "" && projectComboBox.Text != "" && versionComboBox.Text != "")
                {
                    DocumentStorage documentStorage = new DocumentStorage(temp, type, data);
                    Serialization serialize = new Serialization();
                    string output = serialize.serialize(documentStorage);

                    int versionIDs;
                    int projectID;

                    String getProjectIDSqlText = "SELECT projectID FROM Project WHERE projectName='" + projectComboBox.Text + "';";
                    DBCommand getProjectIDSqlCmd = DBConnection.makeCommand(getProjectIDSqlText);
                    SqlCeDataReader getProjectIdReader = getProjectIDSqlCmd.Start();
                    getProjectIdReader.Read();
                    projectID = getProjectIdReader.GetInt32(0);

                    String getVersionIDsSqlText = "SELECT versionID FROM Version, Project WHERE Version.versionNumber=" + versionComboBox.Text.Substring(7) + " AND Version.project=" + projectID + ";";
                    DBCommand getVersionIDsSqlCmd = DBConnection.makeCommand(getVersionIDsSqlText);
                    SqlCeDataReader getVersionIDsReader = getVersionIDsSqlCmd.Start();
                    getVersionIDsReader.Read();
                    versionIDs = getVersionIDsReader.GetInt32(0);

                    String nextSqlText = "INSERT INTO Document (documentType, dateCreated, data, documentName, versionID) VALUES ('" + documentStorage.DocumentType + "', '" + DateTime.Now.Date + "', '" + output + "', '" + documentStorage.DocumentName + "', '" + versionIDs + "');";
                    DBCommand insertSqlCmd = DBConnection.makeCommand(nextSqlText);
                    insertSqlCmd.RunNoReturnQuery();

                    return true;
                }
            }
            MessageBox.Show("Version already exists for this Project.", "Test Management Tool", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            return false;
        }
Exemplo n.º 3
0
        private void updateDataToDB()
        {
            string[] controlData = new string[outputPanel.Controls[0].Controls[2].Controls.Count / 2];
            int counter = 0;
            for (int i = 0; i < outputPanel.Controls[0].Controls[2].Controls.Count; i++)
            {
                if (i % 2 != 0)
                {
                    controlData[counter] = outputPanel.Controls[0].Controls[2].Controls[i].Text;
                    counter++;
                }
            }

            Serialization saveString = new Serialization();
            DocumentStorage doc = new DocumentStorage("", "", controlData);
            string data = saveString.serialize(doc);
            string updateSqlText = "UPDATE Document SET data='" + data + "' WHERE documentID =" + documentID + ";";
            DBCommand updateSqlCmd = DBConnection.makeCommand(updateSqlText);
            updateSqlCmd.RunNoReturnQuery();
            MessageBox.Show("Update Data Synchronization Successful", "Test Management Tool", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }