public static void AddBusVal(string id, string name, string mapName, string stratID) { RoadMap map = new RoadMap(mapName); StrategyPoint point = map.GetPoint(stratID); BusinessValue newBusVal = new BusinessValue(id, mapName); point.CreateBusinessValue(id, name, mapName); //function to add to database }
public static void AddProject(string id, string name, string mapName, string stratID, string valID) { RoadMap map = new RoadMap(mapName); StrategyPoint point = map.GetPoint(stratID); BusinessValue val = point.GetBusinessValue(valID); Project newProj = new Project(id, name, valID, mapName); val.CreateNewProject(newProj); //val.addProject(newProj); }
public static void DeleteProj(string ProjId, string BusId, string StratId, string mapName) { RoadMap map = new RoadMap(mapName); map.GetPoint(StratId).GetBusinessValue(BusId).DeleteProject(ProjId); }
public static void SetProjPos(string id, string mapName, string stratID, string BusID, float startPos, float width) { int pointindex = id.IndexOf("Bus"); int valindex = id.IndexOf("Proj"); string point = id.Substring(0, pointindex); //string val = id.Substring(pointindex, valindex); //string pro = id.Substring(valindex, -1); RoadMap map = new RoadMap(mapName); StrategyPoint newpoint = map.GetPoint(point); BusinessValue newval = newpoint.GetBusinessValue(BusID); Project newproj = newval.GetProject(id); //set width and start position newproj.SetWidth((int)width); startPos -= 47f; newproj.SetLeft((int)startPos); }
public static void SetColor(string id, string color, string mapName) { RoadMap map = new RoadMap(mapName); StrategyPoint point = map.GetPoint(id); point.EditColor(color); }
public static void SetAll(string ProjectID, string RoadmapName, string[] proj_dep, string[] link_arr, string[] string_dep, string desc, string risk) { List<Project> tot_list = new List<Project>(); // Total List of projects List<string> P_list = new List<string>(); // List<Project> P_list2 = new List<Project>(); List<Project> dep_list = new List<Project>(); List<Link> Link_List = new List<Link>(); List<string> Dep_Names = new List<string>(); List<string> Dep_Names2 = new List<string>(); int pointindex = ProjectID.IndexOf("Bus"); int valindex = ProjectID.IndexOf("Proj"); string point = ProjectID.Substring(0, pointindex); string val = ProjectID.Substring(0, valindex); RoadMap map = new RoadMap(RoadmapName); StrategyPoint newpoint = map.GetPoint(point); BusinessValue newval = newpoint.GetBusinessValue(val); Project newproj = newval.GetProject(ProjectID); //setting newproj.SetModalDescription(desc); newproj.SetProjectRisks(risk); P_list = newproj.GetDependencies(); tot_list = map.GetAllProjects(); Link_List = GetProjectLinks(ProjectID, RoadmapName); Dep_Names = newproj.GetDependantStrings(); //DELETE ALL DEPENDENTS using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["connstring"].ConnectionString)) { using (SqlCommand cmd = new SqlCommand()) { cmd.CommandText = "DELETE FROM [dbo].[Dependents] WHERE ProjectName=@Pname AND RoadmapName=@Rname"; cmd.Parameters.AddWithValue("@Pname", ProjectID); cmd.Parameters.AddWithValue("@Rname", RoadmapName); cmd.Connection = conn; conn.Open(); cmd.ExecuteNonQuery(); conn.Close(); } } //Add in new dependents list using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["connstring"].ConnectionString)) { foreach (string s in proj_dep) { Project proj=null; foreach (Project pro in tot_list) { if (pro.GetDescription() == s) { proj = pro; } } if (proj == null) break; using (SqlCommand cmd = new SqlCommand()) { cmd.CommandText = "INSERT INTO [dbo].[Dependents] (ProjectName, DependantName,Description, RoadmapName) VALUES (@Pname, @Dname,'this column is dumb', @Rname)"; cmd.Parameters.AddWithValue("@Pname", ProjectID); cmd.Parameters.AddWithValue("@Dname", proj.GetName()); cmd.Parameters.AddWithValue("@Rname", RoadmapName); cmd.Connection = conn; conn.Open(); cmd.ExecuteNonQuery(); conn.Close(); } } } //SEPARATE THE LINK //Check if link exists, if not create it bool lflag = false; foreach (string str_link in link_arr) { lflag = false; foreach (Link l_list in Link_List) { if (str_link == l_list.GetLink()) { lflag = true; } } if (lflag == false) { newproj.CreateLink(new Link("", ProjectID, str_link, RoadmapName)); } } //Delete Links foreach (Link l in Link_List) { bool flag = false; foreach (string l_list in link_arr) { if (l.GetLink() == l_list) { flag = true; } } if (flag == false) { newproj.DeleteLink(l); } } //SEPARATE THER STRINGDEPENDENCY //Check if a string depenedency is already in the list foreach (string s in string_dep) { if (!Dep_Names.Contains(s)) { Dep_Names.Add(s); } } //remove any that are in the list but not in the send in array foreach (string s in Dep_Names) { if (!string_dep.Contains(s)) { Dep_Names2.Add(s); } } foreach (string s in Dep_Names2) { Dep_Names.Remove(s); } newproj.UpdateDependantStrings(Dep_Names); }
public static string GetValue(string id, string mapName) { RoadMap map = new RoadMap(mapName); return map.GetPoint(id).GetDescription(); }
public static List<string> GetProjectLinksString(string ProjectID, string RoadmapName) { List<string> Project_Links = new List<string>(); List<Link> link_list = new List<Link>(); int pointindex = ProjectID.IndexOf("Bus"); int valindex = ProjectID.IndexOf("Proj"); string point = ProjectID.Substring(0, pointindex); string val = ProjectID.Substring(0, valindex); RoadMap map = new RoadMap(RoadmapName); StrategyPoint newpoint = map.GetPoint(point); BusinessValue newval = newpoint.GetBusinessValue(val); Project newproj = newval.GetProject(ProjectID); link_list = newproj.GetLinks(); //for each link just get the link text foreach (Link l in link_list) { Project_Links.Add(l.GetLink()); } //Send link name array return Project_Links; }
public static List<Link> GetProjectLinks(string ProjectID, string RoadmapName) { List<string> Project_Links = new List<string>(); List<Link> link_list = new List<Link>(); int pointindex = ProjectID.IndexOf("Bus"); int valindex = ProjectID.IndexOf("Proj"); string point = ProjectID.Substring(0, pointindex); string val = ProjectID.Substring(0, valindex); RoadMap map = new RoadMap(RoadmapName); StrategyPoint newpoint = map.GetPoint(point); BusinessValue newval = newpoint.GetBusinessValue(val); Project newproj = newval.GetProject(ProjectID); return newproj.GetLinks(); }
public static List<string> GetProjectDependencyText(string ProjectID, string RoadmapName) { List<string> Dep_Names = new List<string>(); int pointindex = ProjectID.IndexOf("Bus"); int valindex = ProjectID.IndexOf("Proj"); string point = ProjectID.Substring(0, pointindex); string val = ProjectID.Substring(0, valindex); RoadMap map = new RoadMap(RoadmapName); StrategyPoint newpoint = map.GetPoint(point); BusinessValue newval = newpoint.GetBusinessValue(val); Project newproj = newval.GetProject(ProjectID); Dep_Names = newproj.GetDependantStrings(); return Dep_Names; }
public static string[][] GetProjectDependencyArr(string ProjectID, string RoadmapName) { List<string> Depon_Names = new List<string>(); List<string> Projecton_List = new List<string>(); List<string> Depof_Names = new List<string>(); List<Project> Projectof_List = new List<Project>(); int pointindex = ProjectID.IndexOf("Bus"); int valindex = ProjectID.IndexOf("Proj"); string point = ProjectID.Substring(0, pointindex); string val = ProjectID.Substring(0, valindex); RoadMap map = new RoadMap(RoadmapName); StrategyPoint newpoint = map.GetPoint(point); BusinessValue newval = newpoint.GetBusinessValue(val); Project newproj = newval.GetProject(ProjectID); Projecton_List = newproj.GetDependencies(); Projectof_List = newproj.GetDependants(); //for each project just get the project names foreach (string p in Projecton_List) { Depon_Names.Add(p); } //for each project just get the project names foreach (Project p in Projectof_List) { Depof_Names.Add(p.GetName()); } string[][] final_return = new string[2][]; int x = 0; int y = 0; final_return[0] = new string[Depon_Names.Count]; final_return[1] = new string[Depof_Names.Count]; foreach (string s in Depon_Names) { final_return[0][x] = s; x+=1; } foreach (string s in Depof_Names) { final_return[1][y] = s; y++; } //Send name arrary return final_return; }
public static List<string> GetProjectDependency(string ProjectID, string RoadmapName) { List<string> Project_Names = new List<string>(); List<string> Project_List = new List<string>(); int pointindex = ProjectID.IndexOf("Bus"); int valindex = ProjectID.IndexOf("Proj"); string point = ProjectID.Substring(0, pointindex); string val = ProjectID.Substring(0, valindex); RoadMap map = new RoadMap(RoadmapName); StrategyPoint newpoint = map.GetPoint(point); BusinessValue newval = newpoint.GetBusinessValue(val); Project newproj = newval.GetProject(ProjectID); Project_List = newproj.GetDependencies(); //for each project just get the project names foreach (string p in Project_List) { Project_Names.Add(p); } //Send name arrary return Project_Names; }
public static string[][] GetAll(string ProjectID, string RoadmapName) { int pointindex = ProjectID.IndexOf("Bus"); int valindex = ProjectID.IndexOf("Proj"); string point = ProjectID.Substring(0, pointindex); string val = ProjectID.Substring(0, valindex); RoadMap map = new RoadMap(RoadmapName); StrategyPoint newpoint = map.GetPoint(point); BusinessValue newval = newpoint.GetBusinessValue(val); Project newproj = newval.GetProject(ProjectID); List<string> DepStr = new List<string>(); List<string> DepProj = new List<string>(); List<string> Link = new List<string>(); List<string> AllProj = new List<string>(); List<string> Proj = new List<string>(); string Desc = newproj.GetModalDescription(); string Risk = newproj.GetProjectRisks(); string Name = newproj.GetDescription(); DepStr = newproj.GetDependantStrings(); DepProj = GetProjectDependency(ProjectID, RoadmapName); Link = GetProjectLinksString(ProjectID, RoadmapName); AllProj = GetAllRoadmapProjectDesc(RoadmapName); List<Project> all_projs = map.GetAllProjects(); List<string> DepProjNames = new List<string>(); foreach (string s in DepProj) { foreach (Project proj in all_projs) { if(proj.GetName() == s) { DepProjNames.Add(proj.GetDescription()); } } } foreach(string rem in AllProj) { if (rem != Name) { Proj.Add(rem); } } string[][] final_return = new string[7][]; final_return[0] = new string[1]; final_return[1] = new string[1]; final_return[2] = new string[1]; final_return[3] = new string[DepStr.Count]; final_return[4] = new string[DepProj.Count]; final_return[5] = new string[Link.Count]; final_return[6] = new string[Proj.Count]; final_return[0][0] = Desc; final_return[1][0] = Risk; final_return[2][0] = Name; int y = 0, x = 0, z = 0, a = 0; foreach (string ds in DepStr) { final_return[3][x] = ds; x++; } foreach (string dp in DepProjNames) { final_return[4][a] = dp; a++; } foreach (string l in Link) { final_return[5][z] = l; z++; } foreach (string ap in Proj) { final_return[6][y] = ap; y++; } return final_return; }
public static void EditStrat(string id, string name, string mapName) { RoadMap map = new RoadMap(mapName); map.GetPoint(id).EditDescription(name); }
public static void EditProject(string id, string name, string mapName, string stratID, string valID) { int pointindex = id.IndexOf("Bus"); int valindex = id.IndexOf("Proj"); string point = id.Substring(0, pointindex); //string val = id.Substring(pointindex, valindex); //string pro = id.Substring(valindex, -1); RoadMap map = new RoadMap(mapName); StrategyPoint newpoint = map.GetPoint(point); BusinessValue newval = newpoint.GetBusinessValue(valID); Project newproj = newval.GetProject(id); newproj.SetDescription(name); }
public static void EditBusVal(string id, string name, string mapName, string stratID) { int pointindex = id.IndexOf("Bus"); string point = id.Substring(0, pointindex); RoadMap map = new RoadMap(mapName); StrategyPoint newpoint = map.GetPoint(point); BusinessValue newval = newpoint.GetBusinessValue(id); newval.SetDescription(name); }