Ejemplo n.º 1
0
        /// Generate a new project number in the database.
        /// NOTE - this saves current changes to the datasource and should be called before other changes.
        /// If the subsequent save to the database fails the project number will be unused and result in an orphan.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public static Entity.ProjectNumber GenerateProjectNumber(this PimsContext context)
        {
            var projectNumber = new Entity.ProjectNumber();

            context.ProjectNumbers.Add(projectNumber);
            context.SaveChanges();
            return(projectNumber);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Generate a formatted project number for a project for the specified `projectNumber`.
 /// </summary>
 /// <param name="projectNumber"></param>
 /// <param name="format"></param>
 /// <returns></returns>
 public static string Generate(this Entity.ProjectNumber projectNumber, string format)
 {
     return(String.Format(format, projectNumber.Id));
 }