public JsonResult edit_form(string asset, string wcoa, string ocoa) { List <string> message = new List <string>(); using (var db = new db_a094d4_demoEntities1()) { try { var production = new production_log(); production.wcoa = wcoa; production.ocoa = ocoa; production.ictags = asset; db.production_log.Attach(production); var entry = db.Entry(production); entry.Property(e => e.ictags).IsModified = true; entry.Property(e => e.ocoa).IsModified = true; // other changed properties db.SaveChanges(); message.Add("Info Has Updated for Asset "); } catch (Exception e) { message.Add(e.InnerException.InnerException.Message); } } return(Json(new { message = message }, JsonRequestBehavior.AllowGet)); }
public ActionResult DeleteConfirmed(string id) { production_log production_log = db.production_log.Find(id); db.production_log.Remove(production_log); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "time,ictags,wcoa,ocoa,Manufacture,Model,CPU,RAM,HDD,serial,channel,pre_coa,location,video_card,screen_size")] production_log production_log) { if (ModelState.IsValid) { db.Entry(production_log).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(production_log)); }
// GET: production_log/Edit/5 public ActionResult Edit(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } production_log production_log = db.production_log.Find(id); if (production_log == null) { return(HttpNotFound()); } return(View(production_log)); }
public JsonResult Search_COA_json(string coa) { coas coa_table = new coas(); production_log production_log_table = new production_log(); //if coa id if (coa.Length == 17) { if (coa.IndexOf("-") == -1) { string temp_new_coa = coa.Insert(5, "-"); temp_new_coa = temp_new_coa.Insert(9, "-"); temp_new_coa = temp_new_coa.Insert(13, "-"); coa = temp_new_coa; } // get coa table info coa_table = (from t in db.coas where t.COA_ID == coa select t).FirstOrDefault(); //get production_log table info } //if product key else { if (coa.IndexOf("-") == -1) { string temp_new_coa = coa.Insert(5, "-"); temp_new_coa = temp_new_coa.Insert(11, "-"); temp_new_coa = temp_new_coa.Insert(17, "-"); temp_new_coa = temp_new_coa.Insert(23, "-"); coa = temp_new_coa; } // get coa table info coa_table = (from t in db.coas where t.PK == coa select t).FirstOrDefault(); //get production_log table info } if (coa_table.Product_Name.Contains("Office")) { production_log_table = (from t in db.production_log where t.ocoa == coa select t).FirstOrDefault(); } else { production_log_table = (from t in db.production_log where t.wcoa == coa select t).FirstOrDefault(); } return(Json(coa_table, JsonRequestBehavior.AllowGet)); //return Json(new {coa_table = coa_table, production_log_table = production_log_table} ,JsonRequestBehavior.AllowGet); }
public JsonResult get_rma(string asset_tag) { var asset = new production_log(); var result = new rma(); string message = "RMA Info Retrieved Successfully"; try { result = (from t in db.rma where t.ictag == asset_tag select t).FirstOrDefault(); asset = (from t in db.production_log where t.ictags == asset_tag select t).FirstOrDefault(); if (result == null) { message = "No RMA Info Found with this Asset"; } } catch (Exception e) { message = e.Message; } return(Json(new { asset = asset, result = result, message = message }, JsonRequestBehavior.AllowGet)); }