/// <summary> /// Hàm xóa 1 SYSMENU /// </summary> /// <param name="id">Danh sách các CODE sẽ xóa gửi từ client lên</param> /// <returns></returns> public JsonResult delete(List <string> code) { int ret = 0; SYSMENU_BUS bus = new SYSMENU_BUS(); List <SYSMENU_OBJ.BusinessObjectID> li_del = new List <SYSMENU_OBJ.BusinessObjectID>(); foreach (string item in code) { li_del.Add(new SYSMENU_OBJ.BusinessObjectID(item)); ret = bus.checkCode(null, new fieldpara("parentcode", item)); if (ret > 0) { ret = -2; break; } } //ok if (ret >= 0) { SYSMENUPRIORITY_BUS bus_smp = new SYSMENUPRIORITY_BUS(); bus.BeginTransaction(); bus_smp.setConnection(bus); foreach (SYSMENU_OBJ.BusinessObjectID obj in li_del) { ret = bus_smp.Delete(new fieldpara("SYSMENUCODE", obj.CODE)); if (ret < 0) { break; } } if (ret >= 0) { ret = bus.DeletetMultiItems(li_del); } if (ret >= 0) { bus.CommitTransaction(); } else { bus.RollbackTransaction(); } } bus.CloseConnection(); return(Json(new { ret = ret }, JsonRequestBehavior.AllowGet)); }