/// <summary> /// Event handler for clicks on "Remove Entry" button. It uses the button tag to delete a History Entry. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void RemoveEntryButton_Click(object sender, RoutedEventArgs e) { Painter.RunUIUpdateByMethod(StartLoading); string senderId = ((Button)sender).Tag.ToString(); bool operationSuccess = await Cabinet.Delete(senderId); if (operationSuccess) { IsFirstOpening = true; GetEntries(); } else { Frame.Navigate(typeof(WarnPage), new WarnPayload(LangResources.ErrorCleaningHistory, typeof(HistoryPage), 2700)); } }
public IHttpActionResult DeleteCabinetByMac(string mac) { if (string.IsNullOrEmpty(mac)) { return(Failure("未指定保险柜")); } try { if (!UserController.LoginDictionary.ContainsKey(GetCookie("token"))) { return(Logout()); } UserInfo userCookie = UserController.LoginDictionary[GetCookie("token")]; if (userCookie == null) { return(Logout()); } SystemLog.Add(new SystemLog { Action = "DeleteCabinet", LogContent = userCookie.Name + "-删除保险柜-" + mac, CreateTime = DateTime.Now, UserID = userCookie.ID, RoleID = userCookie.RoleID, DepartmentID = userCookie.DepartmentID, ClientIP = GetIP(), UserName = userCookie.Name, RealName = userCookie.RealName }); if (Cabinet.Delete(mac)) { return(Success(true)); } return(Failure("删除失败")); } catch (Exception ex) { _logger.Error(ex); return(Failure("删除失败")); } }