public static ReturnObject Edit(HttpContext context, string name, string roles, long? id = null) { Data.Report item; if( id == null || id <= 0 ) item = new Data.Report(); else item = new Data.Report(id); item.Name = name; item.ForRoles = roles; item.Save(); return new ReturnObject { Result = item, Growl = new ReturnGrowlObject { Type = "default", Vars = new ReturnGrowlVarsObject { text = "Report '"+item.Name+"' has been saved.", title = "Report saved" } }, Redirect = new ReturnRedirectObject { Hash = "dev/reports/edit?id="+item.ID.Value.ToString() } }; }
void Interfaces.IView.SetContext(Interfaces.IDataContext contextIn) { Data.Report context = (Data.Report)contextIn; if (context.RunReport && _button_RunReport.Enabled) { runReport(); } }
public ActionResult ReportUpload(ReportUpload file) { if (ModelState.IsValid) { var email = (string)Session["Email"]; if (obj1.Patients.Where(m => m.id == file.patient_id).FirstOrDefault() != null) { DiagnosticCenter Dia = new Data.DiagnosticCenter(); Dia = obj1.DiagnosticCenters.Where(m => m.email == email).FirstOrDefault(); Report R = new Data.Report(); R.center_id = Dia.id; R.patient_id = file.patient_id; R.date_time = DateTime.Now; byte[] data; using (BinaryReader br = new BinaryReader(file.data.InputStream)) { data = br.ReadBytes(file.data.ContentLength); } R.dataName = Path.GetFileName(file.data.FileName); R.datatype = file.data.ContentType; R.data = data; obj1.Reports.Add(R); obj1.SaveChanges(); ViewBag.a = "Successfully Added"; return(View("ReportUpload")); } else { ViewBag.a = "Patient ID not exist"; } } return(View()); }