private void btnAddTemplate_Click(object sender, System.EventArgs e) { var microwave = Wrap(() => _service.GetMicroWave()); Int16 timeleft = microwave.TimeLeft; Potency potency = microwave.Potency; if (microwave.CurrentJob != null) { timeleft = microwave.CurrentJob.Template.TimeLeft; potency = microwave.CurrentJob.Template.Potency; } var newJobTemplate = new JobTemplate(timeleft, potency) { CanDelete = true, Default = false, Instructions = txtOutput.Text, Name = txtSearchTemplate.Text, MealKind = GetSelectedMealKind(), Dot = txtSearchTemplate.Text[0] }; var ds = Wrap(() => _service.SaveTemplate(newJobTemplate)); if (ds != null) { txtSearchTemplate.Text = String.Empty; lbxTemplate.DataSource = ds; } }
public void OverridePotency(Potency potency) { this.Potency = Potency; if (this.CurrentJob != null) { this.CurrentJob.OverridePotency(potency); } }
public DigitalMicroWave(IList <JobTemplate> templates, Int16 defaultTime, Potency defaultPotency) { this.Status = MicroWaveStatus.JobLess; this.CurrentJob = null; this._templateList = templates; this.Potency = defaultPotency; this.TimeLeft = defaultTime; }
// GET: Potencies/Delete/5 public ActionResult DeletePotency(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Potency potency = db.Potencies.Find(id); if (potency == null) { return(HttpNotFound()); } return(View(potency)); }
public ActionResult AddPotency([Bind(Include = "Potency_Id,Potency_mg")] Potency potency) { Potency persuser = db.Potencies.FirstOrDefault(u => u.Potency_mg == (potency.Potency_mg)); if (persuser == null) { db.Potencies.Add(potency); db.SaveChanges(); return(RedirectToAction("ListPotencies")); } else { ModelState.AddModelError("Potency_mg", "Potency Can not be added as it already exists."); } return(View()); }
public ActionResult DeletePotencyConfirmed(int id) { Potency potency = db.Potencies.Find(id); MedicinePotency meddd = db.MedicinePotencies.FirstOrDefault(u => u.Potency_Id == potency.Potency_Id); if (meddd != null) { ModelState.AddModelError("Potency_mg", "This Potency can not be Deleted Because some medicines has this potency."); return(View()); } else { db.Potencies.Remove(potency); db.SaveChanges(); return(RedirectToAction("ListPotencies")); } }
public void OverridePotency(Potency potency) { this.Potency = Potency; }
public JobTemplate(Int16 timeLeft, Potency potency) { this.Id = Guid.NewGuid(); this.TimeLeft = timeLeft; this.Potency = potency; }
/// <summary> /// To be called only by JobTemplateParameterLess /// </summary> public JobTemplate(Int16 timeLeft, Potency potency, Guid id) { this.Id = id; this.TimeLeft = timeLeft; this.Potency = potency; }