public ActionResult DeleteConfirmed(int id) { FunctionalityLevel functionalitylevel = db.FunctionalityLevels.Single(f => f.Id == id); db.FunctionalityLevels.DeleteObject(functionalitylevel); db.SaveChanges(); return RedirectToAction("Index"); }
public ActionResult Edit(FunctionalityLevel functionalitylevel) { if (ModelState.IsValid) { db.FunctionalityLevels.Attach(functionalitylevel); db.ObjectStateManager.ChangeObjectState(functionalitylevel, EntityState.Modified); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.RelatedLevel = new SelectList(db.RelatedFunctionalityLevels, "Id", "Name", functionalitylevel.RelatedLevel); return View(functionalitylevel); }
public ActionResult Create(FunctionalityLevel functionalitylevel) { if (ModelState.IsValid) { db.FunctionalityLevels.AddObject(functionalitylevel); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.RelatedLevel = new SelectList(db.RelatedFunctionalityLevels, "Id", "Name", functionalitylevel.RelatedLevel); return View(functionalitylevel); }
public static void AddFuncScore(string FirstName, int dScore, FunctionalityLevel fl) { ccEntities context = new ccEntities(); var client = context.Clients.First(x => x.FirstName == FirstName); FunctionalityScore fs = new FunctionalityScore(); fs.ClientId = client.Id; fs.DiagnosticScore = dScore; fs.FunctionalityLevel = fl; fs.UpdatedAt = DateTime.Now; fs.UpdatedBy = GetAdminUser().Id; context.SaveChanges(); }
/// <summary> /// Selects the level of functionality in the ME. /// </summary> /// <param name="level">The level of modem functionality.</param> public BaseResult <GenericTypeResult <bool> > SetFunctionality(FunctionalityLevel level) { string response = Commands.RESULT_OK; BaseResult <GenericTypeResult <bool> > ret = new BaseResult <GenericTypeResult <bool> >(); Stopwatch s = new Stopwatch(); s.Start(); response = Connector.Execute(Command.Set(Commands.CFUN, (int)level), delayWhenRead: 2000); s.Stop(); if (response.Contains(Commands.RESULT_OK)) { ret.Response.Result = true; } else { ret.Response.Result = false; } ret.ExecutionTime = s.Elapsed; return(ret); }
/// <summary> /// Selects the level of functionality in the ME. /// </summary> /// <param name="level">The level of modem functionality.</param> public BaseResult<GenericTypeResult<bool>> SetFunctionality(FunctionalityLevel level) { string response = Commands.RESULT_OK; BaseResult<GenericTypeResult<bool>> ret = new BaseResult<GenericTypeResult<bool>>(); Stopwatch s = new Stopwatch(); s.Start(); response = Connector.Execute(Command.Set(Commands.CFUN, (int)level), delayWhenRead:2000); s.Stop(); if (response.Contains(Commands.RESULT_OK)) { ret.Response.Result = true; } else { ret.Response.Result = false; } ret.ExecutionTime = s.Elapsed; return ret; }
public FunctionalityScore MakeScore(FunctionalityScore score, ccEntities db) { db.ContextOptions.LazyLoadingEnabled = false; db.ContextOptions.ProxyCreationEnabled = false; ViewBag.Success = false; ModelState.Clear(); var functiolnalityLevel = FunctionalityLevel.GetLevelByScore(db.FunctionalityLevels, score); if (functiolnalityLevel != null) { score.FunctionalityLevelId = functiolnalityLevel.Id; } var client = db.Clients.SingleOrDefault(f => f.Id == score.ClientId); if (score.StartDate < client.JoinDate) { ModelState.AddModelError(string.Empty, "Start Date cannot be earlier than client's join date."); } var existing = db.FunctionalityScores.Any(f => f.StartDate == score.StartDate && f.ClientId == score.ClientId); if (existing) { ModelState.AddModelError(string.Empty, "Duplicate functionality scores are not allowed" ); } var lastReport = ccEntitiesExtensions.LastSubmittedHcRepDate(score.ClientId); if (this.Permissions.User.RoleId != (int)FixedRoles.Admin && score.StartDate < lastReport) { ModelState.AddModelError(string.Empty, "Start date cannot be within an already submitted Financial Report period."); } TryValidateModel(score); if (ModelState.IsValid) { try { score.UpdatedAt = DateTime.Now; score.UpdatedBy = this.Permissions.User.Id; db.FunctionalityScores.AddObject(score); var rowsUpdated = db.SaveChanges(); if (rowsUpdated > 0) { score = new FunctionalityScore(); } ViewBag.Success = true; } catch (ValidationException ex) { ModelState.AddModelError(ex.GetType().ToString(), ex); } catch (UpdateException ex) { ModelState.AddModelError(ex.GetType().ToString(), ex); ModelState.AddModelError(string.Empty, ex.InnerException.Message); } catch (Exception ex) { ModelState.AddModelError(string.Empty, ex.Message); } } return(score); }
// // GET: /Admin/FunctionalityLevels/Delete/5 public ActionResult Delete(int id) { FunctionalityLevel functionalitylevel = db.FunctionalityLevels.Single(f => f.Id == id); return View(functionalitylevel); }
// // GET: /Admin/FunctionalityLevels/Edit/5 public ActionResult Edit(int id) { FunctionalityLevel functionalitylevel = db.FunctionalityLevels.Single(f => f.Id == id); ViewBag.RelatedLevel = new SelectList(db.RelatedFunctionalityLevels, "Id", "Name", functionalitylevel.RelatedLevel); return View(functionalitylevel); }
// // GET: /Admin/FunctionalityLevels/Details/5 public ViewResult Details(int id) { FunctionalityLevel functionalitylevel = db.FunctionalityLevels.Single(f => f.Id == id); return View(functionalitylevel); }