private void BasicValidation(CE.Project newProject)
 {
     if (newProject.Name == null)
         InfoList.Items.Add("Please enter the project name");
     else if(!Regex.IsMatch(newProject.Name, "^[a-zA-Z0-9]+$"))
         InfoList.Items.Add("The project name must consist exclusively of letters and digits");
     if(newProject.ConnstringIS == null)
         InfoList.Items.Add("Please enter the connection string through which the application can access the corresponding INFORMATION_SCHEMA.");
     if (newProject.ConnstringWeb == null)
         InfoList.Items.Add("Please enter the connection string through which the application can access the production database.");
 }
Exemple #2
0
 public void UpdateProject(CE.Project project)
 {
     DataTable projectsTable = GetProjects();
     DataRow projectRow = projectsTable.Rows.Find(project.Id);
     try
     {
         projectRow["server_type"] = project.ServerType;
         projectRow["name"] = project.Name;
         projectRow["connstring_web"] = project.ConnstringWeb;
         projectRow["connstring_information_schema"] = project.ConnstringIS;
     }
     catch (ConstraintException ce) {
         throw new ConstraintException("The name of the project must be unique.", ce);
     }
     SaveProjectsTable(projectsTable);
 }
Exemple #3
0
        public int InsertProject(CE.Project project)
        {
            DataTable projects = GetProjects();
            DataRow newRow = projects.NewRow();
            newRow["server_type"] = project.ServerType.ToString();
            newRow["name"] = project.Name;
            newRow["connstring_web"] = project.ConnstringWeb;
            newRow["connstring_information_schema"] = project.ConnstringIS;
            newRow["version"] = project.Version;

            try {
                projects.Rows.Add(newRow);
            }
            catch(ConstraintException ce){

                throw new ConstraintException("The name of the project must be unique.", ce);
            }

            SaveProjectsTable(projects);

            return (int)newRow["id_project"];
        }
Exemple #4
0
 public static IEnumerable <Type> GetKnownTypes()
 {
     return(CE.GetKnownTypes());
 }
        public void UpdateProject(CE.Project project)
        {
            if (!driver.CheckUniqueness("projects", "name", project.Name, "id_project", project.Id))
            {
                throw new ConstraintException("The name of the project must be unique.");
            }

             Dictionary<string, object> updVals = new Dictionary<string, object>{
                {"name", project.Name},
                {"connstring_web", project.ConnstringWeb},
                {"connstring_information_schema", project.ConnstringIS}
             };

            driver.query("UPDATE projects SET ", dbe.UpdVals(updVals), " WHERE id_project = ", project.Id);
        }
        public int InsertProject(CE.Project project)
        {
            if (!driver.CheckUniqueness("projects", "name", project.Name)) {
                throw new ConstraintException("The name of the project must be unique.");
            }
            Dictionary<string, object> insVals = new Dictionary<string, object>{
                {"name", project.Name},
                {"connstring_web", project.ConnstringWeb},
                {"connstring_information_schema", project.ConnstringIS},
                {"version", project.Version}
            };

            driver.BeginTransaction();
            driver.query("INSERT INTO projects ", dbe.InsVals(insVals));
            int id = driver.LastId();
            driver.CommitTransaction();
            return id;
        }