public void GetByAssesmentID_AssesmentFound_EvaluationHasName() { Assesment a = new Assesment(DEFAULT_ASSESMENT_ID); AssesmentTO to = a.GetInfo(); Assert.AreEqual(true, !String.IsNullOrEmpty(to.Evaluation.Name)); }
public void GetByID_AssesmentFound_IdIsValid() { Assesment a = new Assesment(DEFAULT_ID); AssesmentTO to = a.GetInfo(); Assert.AreEqual(true, !String.IsNullOrEmpty(to.Evaluation.Name)); }
public void GetByAssesmentID_AssesmentDoesNotExist_ElementIsNull() { Assesment a = new Assesment("xxx"); AssesmentTO to = a.GetInfo(); Assert.IsNull(to); }
public void GetByAssesmentID_AssesmentFound_DefaultIdIsRight() { Assesment a = new Assesment(DEFAULT_ASSESMENT_ID); AssesmentTO to = a.GetInfo(); Assert.AreEqual(1, to.ID); }
public void GetByID_AssesmentNotFound_ObjectIsNull() { Assesment a = new Assesment(0); AssesmentTO to = a.GetInfo(); Assert.AreEqual(null, to); }
public void GetByAssesmentID_AssesmentFound_ElementIsNotNull() { Assesment a = new Assesment(DEFAULT_ASSESMENT_ID); AssesmentTO to = a.GetInfo(); Assert.IsNotNull(to); }
private void SetDbFinishDate(int id) { AssesmentTO assesment = db.Assesments.Find(id); assesment.DateFinished = DateTime.Now; assesment.Status = AssesmentStatus.Done; db.Entry(assesment).CurrentValues.SetValues(assesment); db.SaveChanges(); }
public Assesment(int id) { this.id = id; info = AssesmentPersistence.GetByID(id); if (info != null) { InitAdditionalData(); } }
public Assesment(string assesmentID) { info = AssesmentPersistence.GetByAssesmentID(assesmentID); if (info != null) { this.assesmentID = assesmentID; this.id = info.ID; InitAdditionalData(); } }
public void Restart() { AssesmentTO assesment = db.Assesments.Find(id); assesment.DateFinished = null; assesment.DateStarted = null; db.Entry(assesment).CurrentValues.SetValues(assesment); db.SaveChanges(); UpdateBdContext(id, GetDefaultContext()); }
public Assesment(string assesmentID) { info = (from a in db.Assesments where a.AssesmentKey == assesmentID select a).FirstOrDefault(); if (info != null) { SetData(info.AssesmentId); } }
public static AssesmentTO GetByID(int id) { AssesmentTO element = null; string execCommand = String.Format(command, "ID", id); DataTable table = ExecuteCommand(execCommand); if (table != null && table.Rows.Count > 0) { element = MapElement(table); } return(element); }
public Assesment(int id) { this.id = id; info = (from a in db.Assesments where a.AssesmentId == id select a).FirstOrDefault(); if (info != null) { SetData(info.AssesmentId); } }
private AssesmentTO GetAssesmentInfo() { AssesmentTO info = new AssesmentTO(); info.Company = new CompanyTO(); info.Company.Name = "Intrepidez"; info.Company.Logo = "logo-intrepidez.png"; info.Evaluation = new EvaluationTO(); info.Evaluation.Name = "EVALUACIÓN INTEGRAL DESARROLLADOR DE SOFTWARE"; info.PersonName = "Mauricio Bedoya"; info.DateFinished = DateTime.Now; info.ID = 1; return(info); }
private void SetData(int id) { info = (from a in db.Assesments.Include("Company").Include("Evaluation").AsNoTracking() where a.AssesmentId == id select a).FirstOrDefault(); this.assesmentID = info.AssesmentKey; this.id = info.AssesmentId; if (info.DateStarted != null) { info.Status = AssesmentStatus.Started; } if (info.DateFinished != null) { info.Status = AssesmentStatus.Done; } InitAdditionalData(); }
private static AssesmentTO MapElement(DataTable table) { AssesmentTO element = null; element = new AssesmentTO(); element.ID = Convert.ToInt32(table.Rows[0]["ID"]); element.Status = AssesmentStatus.Created; element.PersonName = Convert.ToString(table.Rows[0]["PersonName"]); if (!(table.Rows[0]["DateStarted"] is DBNull)) { element.DateStarted = Convert.ToDateTime(table.Rows[0]["DateStarted"]); element.Status = AssesmentStatus.Started; } if (!(table.Rows[0]["DateFinished"] is DBNull)) { element.DateFinished = Convert.ToDateTime(table.Rows[0]["DateFinished"]); element.Status = AssesmentStatus.Done; } element.Type = AssementType.Internal; if (table.Rows[0]["AssesmentType"].ToString().ToLower() == "candidate") { element.Type = AssementType.Candidate; } element.Company = new CompanyTO(); element.Company.ID = Convert.ToInt32(table.Rows[0]["CompanyID"]); element.Company.Name = Convert.ToString(table.Rows[0]["Name"]); element.Company.Logo = Convert.ToString(table.Rows[0]["LogoPath"]); element.Evaluation = new EvaluationTO(); element.Evaluation.ID = Convert.ToInt32(table.Rows[0]["EvalID"]); element.Evaluation.Name = Convert.ToString(table.Rows[0]["EvalName"]); element.Evaluation.Description = Convert.ToString(table.Rows[0]["EvalDescription"]); return(element); }
public ActionResult GetData() { Assesment assesment = Session[SESSION_ASSESMENT_OBJECT] != null ? (Assesment)Session[SESSION_ASSESMENT_OBJECT] : null; if (assesment == null) { return(Json(new { }, JsonRequestBehavior.AllowGet)); } AssesmentTO obj = assesment.GetInfo(); IEnumerable <SectionDTO> list = from s in obj.Evaluation.Sections select new SectionDTO() { SectionId = s.SectionId, Name = s.Name, Description = s.Description, EstimatedDuration = s.EstimatedDuration, Type = s.Type }; return(Json(new { obj = new { Evaluation = new { Name = obj.Evaluation.Name, Description = obj.Evaluation.Description }, Company = obj.Company }, Sections = list }, JsonRequestBehavior.AllowGet)); }