public Appraisal Find(int TableID, bool recursive = true, bool byDiscussed = false) { using (DataTable dt = this.DBHandler.Execute <DataTable>(CRUD.READ, "SELECT * FROM Appraisal WHERE " + (byDiscussed ? " DiscussedWith " : " AppraisalID ") + " = " + TableID)) { if (dt.Rows.Count > 0) { DataRow row = dt.Rows[0]; this.AppraisalID = Int32.Parse(row["AppraisalID"].ToString()); this.CoveredPeriod = DateTime.Parse(row["CoveredPeriod"].ToString()); this.Rating = Double.Parse(row["Rating"].ToString()); this.TechComp = Double.Parse(row["TechComp"].ToString()); this.InterSkills = Double.Parse(row["InterSkills"].ToString()); this.CommComp = Double.Parse(row["CommComp"].ToString()); this.Total = Double.Parse(row["Total"].ToString()); this.Comments = row["Comments"].ToString(); if (!row.IsNull("DatePrepared")) { this.DatePrepared = DateTime.Parse(row["DatePrepared"].ToString()); } if (!row.IsNull("DateNoted")) { this.DateNoted = DateTime.Parse(row["DateNoted"].ToString()); } if (!row.IsNull("DateDiscussed")) { this.DateDiscussed = DateTime.Parse(row["DateDiscussed"].ToString()); } this.Type = (AppraisalType)Int32.Parse(row["Type"].ToString()); this.Status = (AppraisalStatus)Int32.Parse(row["Status"].ToString()); if (recursive) { if (!row.IsNull("Evaluator")) { this.Evaluator = (Employee) new Employee().FindProfile(Int32.Parse(row["Evaluator"].ToString()), byPrimary: true); } if (!row.IsNull("NotedBy")) { this.NotedBy = (Employee) new Employee().FindProfile(Int32.Parse(row["NotedBy"].ToString()), byPrimary: true); } if (!row.IsNull("DiscussedWith")) { this.DiscussedWith = (Employee) new Employee().FindProfile(Int32.Parse(row["DiscussedWith"].ToString()), byPrimary: true); } } } else { throw new Exception("Error: Failed to find appraisal."); } } return(this); }
public AppraisalResult(AppraisalStatus status, string message = "") { Status = status; Message = message; }