Beispiel #1
0
        /// <summary>
        /// Constructor no.4 that builds a project object from an existing project in the db with a datarow that is given to it
        /// if LoadPositions = true => the project creates the Project positions aswell as the other fields.
        /// </summary>
        public Project(DataRow row, bool LoadPositions)
        {
            this.ProjectID        = (int)row["ProjectID"];
            this.AdminUSID        = (int)row["AdminUSID"];
            this.MinAge           = (int)row["MinAge"];
            this.ProjectStatus    = (int)row["ProjectStatus"];
            this.NumRateVoters    = (int)row["NumRateVoters"];
            this.ProjectRate      = (int)row["ProjectRate"];
            this.ProjectContent   = (string)row["ProjectContent"];
            this.DateCreated      = (DateTime)row["DateCreated"];
            this.ProjectPositions = new List <ProjectPos>();
            DataTable dtPos = ProjectDB.ReturnProjectPositions(ProjectID);

            if (dtPos != null && LoadPositions)
            {
                foreach (DataRow posRow in dtPos.Rows)
                {
                    ProjectPos position = new ProjectPos((int)posRow["ID"], (int)posRow["UserID"], (int)posRow["Profession"]);
                    ProjectPositions.Add(position);
                }
            }
        }