public static bool Delete(VMMenu paramModel) { bool result = true; try { using (var db = new Markom_IDLEEntities()) { m_menu a = db.m_menu.Where(o => o.id == paramModel.id).FirstOrDefault(); if (a != null) { a.is_delete = true; db.SaveChanges(); } else { result = false; } } } catch (Exception hasError) { result = false; if (hasError.Message.ToLower().Contains("inner exception")) { Message = hasError.InnerException.InnerException.Message; } else { Message = hasError.Message; } } return(result); }
public static VMMenu GetDetailById(int Id) { VMMenu result = new VMMenu(); using (var db = new Markom_IDLEEntities()) { result = (from a in db.m_menu where a.id == Id select new VMMenu { id = a.id, code = a.code, name = a.name, controller = a.controller, parent_id = a.parent_id, is_delete = a.is_delete, created_by = a.created_by, created_date = a.created_date, updated_by = a.updated_by, updated_date = a.updated_date }).FirstOrDefault(); } return(result); }
public ActionResult Edit(VMMenu paramModel) { try { MenuRepo.Message = string.Empty; paramModel.updated_by = "Dzul"; paramModel.updated_date = DateTime.Now; if (null == paramModel.name) { MenuRepo.Message = "Anda belum memasukan semua data. Silahkan ulangi kembali"; } if (string.IsNullOrEmpty(MenuRepo.Message)) { return(Json(new { success = MenuRepo.Update(paramModel), message = MenuRepo.Message }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { success = false, message = MenuRepo.Message }, JsonRequestBehavior.AllowGet)); } } catch (Exception hasError) { return(Json(new { success = false, message = hasError.Message }, JsonRequestBehavior.AllowGet)); } }
public static bool Insert(VMMenu paramModel) { bool result = true; try { using (var db = new Markom_IDLEEntities()) { m_menu a = new m_menu(); a.code = paramModel.code; a.name = paramModel.name; a.controller = paramModel.controller; a.parent_id = paramModel.parent_id; a.is_delete = paramModel.is_delete; a.created_by = paramModel.created_by; a.created_date = paramModel.created_date; db.m_menu.Add(a); db.SaveChanges(); } } catch (Exception hasError) { result = false; if (hasError.Message.ToLower().Contains("inner exception")) { Message = hasError.InnerException.InnerException.Message; } else { Message = hasError.Message; } } return(result); }
private void Buttn_Clicked(object sender, EventArgs e) { VMMenu menu = new VMMenu(EntryNombre.Text, Convert.ToDouble(EntryPrecio.Text), Convert.ToInt16(NumeroIngredientes.Text), Nacionalidad.Text, Convert.ToInt16(Accion.Text)); DisplayAlert("Notificacion", menu.retornarMensaje(), "ok"); }
public ActionResult Create(VMMenu paramModel) { try { MenuRepo.Message = string.Empty; //Create auto generate product_code using (var db = new Markom_IDLEEntities()) { string nol = ""; m_menu cek = db.m_menu.OrderByDescending(x => x.code).First(); int simpan = int.Parse(cek.code.Substring(3)); simpan++; for (int i = simpan.ToString().Length; i < 4; i++) { nol = nol + "0"; } paramModel.code = "ME" + nol + simpan; } paramModel.created_by = "Administrator"; paramModel.created_date = DateTime.Now; paramModel.is_delete = false; if (null == paramModel.name) { MenuRepo.Message = "Anda belum memasukan semua data. Silahkan ulangi kembali"; } if (string.IsNullOrEmpty(MenuRepo.Message)) { return(Json(new { success = MenuRepo.Insert(paramModel), message = paramModel.code }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { success = false, message = MenuRepo.Message }, JsonRequestBehavior.AllowGet)); } } catch (Exception hasError) { return(Json(new { success = false, message = hasError.Message }, JsonRequestBehavior.AllowGet)); } }
public ActionResult Delete(VMMenu paramModel) { try { return(Json(new { success = MenuRepo.Delete(paramModel), message = MenuRepo.Message }, JsonRequestBehavior.AllowGet)); } catch (Exception hasError) { return(Json(new { success = false, message = hasError.Message }, JsonRequestBehavior.AllowGet)); } }
//coneection to vmMenu public void init() { VMMenu vm = new VMMenu(Id); this.DataContext = vm; }
public cmdFood(VMMenu vm, String id) { mVm = vm; Id = id; }
public cmdQuery(VMMenu vm) { qVm = vm; }
public cmdGrahp(VMMenu vm, String id) { mVm = vm; Id = id; }