public JsonResult Edit(PortEntry model) { var apiResult = new APIResult(); try { PortEntryBll.AddOrUpdate(model, UserContext.CurrentUser.HotelId); } catch (Exception ex) { apiResult.Ret = -1; apiResult.Msg = ex.Message; if (!(ex is OperationExceptionFacade)) { LogFactory.GetLogger().Log(LogLevel.Error, ex); } } return(Json(apiResult)); }
private void RefreshLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { RefreshLink.Text = "Refreshing..."; EntryList.Items.Clear(); // add ports in seperate thread UPnP.ActionQueue.Enqueue(() => { string type = IPradio.Checked ? "WANIP" : "WANPPP"; UPnP.RefreshDevices(); foreach (UPnPDevice device in UPnP.Devices.Where(d => d.Name.Contains(type))) { for (int i = 0; i < 250; i++) { PortEntry entry = UPnP.GetPortEntry(device, i); if (entry == null) { break; } else { // add to list box BeginInvoke(new Action(() => EntryList.Items.Add(entry))); } } } // finish BeginInvoke(new Action(() => RefreshLink.Text = "Refresh")); }); RefreshInterface(); }