internal static void AddProperties(string[] properties, Project project, bool visible, bool important, String author) { ProjectPropertiesEntities db = new ProjectPropertiesEntities(); if (db.Connection.State != System.Data.ConnectionState.Open) { db.Connection.Open(); } try { foreach (String property in properties) { Value toAdd = Value.CreateValue(property, project.Id, visible, important, author); if (toAdd == null) { throw new IllegalDBOperationException(project); } else { db.AddToValues(toAdd); } } db.SaveChanges(); } catch(IllegalDBOperationException e) { throw e; } catch (Exception e) { throw new ConnectionException(e); } finally { } }
/// <summary> /// /// </summary> /// <param name="project"></param> /// <param name="systemName"></param> /// <returns>Value of project property or what user gave method if project doesn't have such property.</returns> /// <exception cref="ConnectionException" /> internal static string GetValue(Project project, String systemName) { ProjectPropertiesEntities db = new ProjectPropertiesEntities(); if (db.Connection.State != System.Data.ConnectionState.Open) { db.Connection.Open(); } try { Value toReturn = project.Values.FirstOrDefault(x => x.SystemName == systemName); if (toReturn == null) { return systemName; } else { return toReturn.Value1; } } catch (Exception e) { throw new ConnectionException(e); } finally { } }
protected Dictionary<String, String> EvaluateVariables(Project project) { Dictionary<String, String> toReturn = new Dictionary<string, string>(); foreach (String variable in variables) { toReturn.Add(variable, project.GetValue(variable)); } return toReturn; }
protected Dictionary<String, String> EvaluateFormulas(Project project) { Dictionary<String, String> toReturn = new Dictionary<String, String>(); foreach (String function in functions) { toReturn.Add(function, SQLParser.Execute(function, project)); } return toReturn; }
/// <summary> /// Create a new Project object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="created">Initial value of the Created property.</param> public static Project CreateProject(global::System.Int32 id, global::System.DateTime created) { Project project = new Project(); project.Id = id; project.Created = created; return project; }
/// <summary> /// Deprecated Method for adding a new object to the Projects EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToProjects(Project project) { base.AddObject("Projects", project); }