public ActionResult AddNote(string noteMessage, string coilId, string workCenterId) { var result = new ResponseDataModel(); var data = new JobStatusModel(); try { axService.AddNote(noteMessage, coilId, workCenterId); data.Id = coilId; data.Message = "Note added successfully."; } catch (Exception ex) { result.Error = true; result.Message = ex.Message; } result.Data = data; return View(result); }
public ActionResult GenerateNcm(string coilId, string problem, int defectiveLbs) { var result = new ResponseDataModel(); var data = new JobStatusModel(); try { workCenterService.GenerateMcn(coilId, problem, defectiveLbs); data.Id = coilId; data.Message = "NCM generated successfully."; } catch (Exception ex) { result.Error = true; result.Message = ex.Message; } result.Data = data; return Json(result); }
public ActionResult SendEmail(string from, string subject, string message) { var model = new ResponseDataModel(); try { var to = @"*****@*****.**"; MailMessage mailMessage = new MailMessage(); mailMessage.From = new MailAddress(from); mailMessage.Subject = string.Format("SPARK question - {0}", subject); mailMessage.To.Add(to); mailMessage.Body = string.Format("<p>From:{0}</p><p>{1}</p>",from,message); mailMessage.ReplyToList.Add( from); mailMessage.IsBodyHtml = true; var smtp = new SmtpClient("smtp.gmail.com",587); smtp.EnableSsl = true; smtp.Credentials = new NetworkCredential("*****@*****.**", "brandun11!!"); smtp.Send(mailMessage); model.Error = false; model.Message = string.Format("Message sent to {0}", to); } catch (Exception ex) { model.Error = true; model.Message = ex.Message; } return Json(model); }
public ActionResult StartActivity(string activityCode, string workCenterId) { var model = new ResponseDataModel(); try { workCenterService.StartActivityForWorkCenter(activityCode, workCenterId); model.Data = new List<JobStatusModel>() {new JobStatusModel() { Id = activityCode, Message = "Activity started successfully." }}; } catch (Exception ex) { model.Error = true; model.Message = ex.Message; } return Json(model); }
public ActionResult StopJob(List<string> JobIds, string workCenterId) { var model = new ResponseDataModel(); try { List<JobStatusModel> results = new List<JobStatusModel>(); foreach (var j in JobIds) { workCenterService.StopJob(j, workCenterId); results.Add(new JobStatusModel() { Id = j, Message = "Job stopped successfully." }); } model.Data = results; } catch (Exception ex) { model.Error = true; model.Message = ex.Message; } return Json(model); }