public void Add(CheckListItem item) { if (item == null) { throw new ArgumentNullException(); } if (_isStorageChanged) { RefreshCache(); } if (_cache.Count() > 0) { item.Id = _cache.Values.Select(x => x.Id).Max() + 1; } else { item.Id = 1; } _cache.Add(item.Id, item); Save(); }
public ExportOptions() { CheckList = new ObservableCollection<CheckListItem<string>>(); _optionToTitleMap = new Dictionary<string, string>(); PopulateOptionsList(); foreach (var kvp in _optionToTitleMap) { var item = new CheckListItem<string>(kvp.Value, true); item.Tag = kvp.Key; CheckList.Add(item); } }
protected void FillSearchCriterias() { StartTime = EndTime = null; SortAscending = false; SearchStatus = string.Empty; SortOrders.Clear(); Payments.Clear(); foreach (PaymentCriteria test in Enum.GetValues(typeof(PaymentCriteria))) { var item = new CheckListItem <PaymentCriteria>(EnumLocalizer.Default.Translate(test), test); Payments.Add(item); } foreach (ProductsSortOrder test in Enum.GetValues(typeof(ProductsSortOrder))) { var item = new CheckListItem <ProductsSortOrder>(EnumLocalizer.Default.Translate(test), test); SortOrders.Add(item); } SelectedPayment = PaymentCriteria.Any; SelectedSortOrder = ProductsSortOrder.ByDate; }
public void DeleteCheckListItem(CheckListItem item) { this.checkLists.First(x => x.CheckListItems.Any(y => y.Id == item.Id)).CheckListItems.Remove(item); updateWebResource(); }
public void Add(CheckListItem checkListItem) { _connection.Insert(checkListItem); }
public void Update(CheckListItem checkListItem) { _connection.Update(checkListItem); }
public void Delete(CheckListItem item) { if (_isStorageChanged) { RefreshCache(); } _cache.Remove(item.Id); Save(); }
protected void FillSearchCriterias() { SortAscending = false; Countries.Clear(); Groups.Clear(); Genders.Clear(); CalendarPrivacy.Clear(); MeasurementPrivacy.Clear(); Photos.Clear(); Plans.Clear(); SearchStatus = string.Empty; SortOrders.Clear(); foreach (var test in Country.Countries) { CheckListItem <Country> item = new CheckListItem <Country>(test.DisplayName, test); Countries.Add(item); } foreach (UserSearchGroup test in Enum.GetValues(typeof(UserSearchGroup))) { var item = new CheckListItem <UserSearchGroup>(EnumLocalizer.Default.Translate(test), test); Groups.Add(item); } foreach (Gender test in Enum.GetValues(typeof(Gender))) { var item = new CheckListItem <Gender>(EnumLocalizer.Default.Translate(test), test); Genders.Add(item); } foreach (PrivacyCriteria test in Enum.GetValues(typeof(PrivacyCriteria))) { var item = new CheckListItem <PrivacyCriteria>(EnumLocalizer.Default.Translate(test), test); CalendarPrivacy.Add(item); } foreach (PrivacyCriteria test in Enum.GetValues(typeof(PrivacyCriteria))) { var item = new CheckListItem <PrivacyCriteria>(EnumLocalizer.Default.Translate(test), test); MeasurementPrivacy.Add(item); } foreach (UsersSortOrder test in Enum.GetValues(typeof(UsersSortOrder))) { var item = new CheckListItem <UsersSortOrder>(EnumLocalizer.Default.Translate(test), test); SortOrders.Add(item); } foreach (PictureCriteria test in Enum.GetValues(typeof(PictureCriteria))) { var item = new CheckListItem <PictureCriteria>(EnumLocalizer.Default.Translate(test), test); Photos.Add(item); } foreach (UserPlanCriteria test in Enum.GetValues(typeof(UserPlanCriteria))) { var item = new CheckListItem <UserPlanCriteria>(EnumLocalizer.Default.Translate(test), test); Plans.Add(item); } SelectedCalendarPrivacy = PrivacyCriteria.All; SelectedMeasurementPrivacy = PrivacyCriteria.All; SelectedPhoto = PictureCriteria.All; SelectedPlan = UserPlanCriteria.All; SelectedSortOrder = UsersSortOrder.ByLastLoginDate; }
public void RemoveCheckListItem(CheckListItem item) { _checkListItemRepository.Delete(item); }
public void DeleteCheckListItem(CheckListItem item) { throw new NotImplementedException(); }
/// <summary> /// Delete an existing CheckListItem /// </summary> /// <returns></returns> public async Task DeleteCheckListItemAsync(CheckListItem checkListItem) { await _checkListItemRepository.DeleteAsync(checkListItem); }
public async Task CheckListItemUpdatedAsync(CheckListItem result) => await User.SendAsync("checkListItemUpdated", result);
/// <summary> /// Create a new CheckListItem /// </summary> /// <returns></returns> public async Task CreateCheckListItemAsync(CheckListItem checkListItem) { await _checkListItemRepository.InsertAsync(checkListItem); }
/// <summary> /// Update an existing CheckListItem /// </summary> /// <returns></returns> public async Task UpdateCheckListItemAsync(CheckListItem checkListItem) { await _checkListItemRepository.UpdateAsync(checkListItem); }
/// <summary> /// Determines whether the specified <see cref="CheckListItem" />, is equal to this instance. /// </summary> /// <param name="other">The other.</param> /// <returns>true if equal; otherwise, false</returns> protected bool Equals(CheckListItem other) => base.Equals(other) && Checked == other.Checked;
/// <summary> /// Update cache from file /// </summary> void RefreshCache() { _isStorageChanged = false; if (System.IO.File.Exists(_fullPath)) { var lines = System.IO.File.ReadAllLines(_fullPath); foreach(var recordText in lines) { // skip empty lines if (string.IsNullOrWhiteSpace(recordText) == false) { var fields = recordText.Split(';'); if (fields.Count() == 3) { try { var record = new CheckListItem() { Id = int.Parse(fields[0]), Description = fields[1], State = (ItemState)Enum.Parse(typeof(ItemState), fields[2]) }; if (_cache.ContainsKey(record.Id)) { // update if not equal if (record.Equals(_cache[record.Id]) == false) { _cache[record.Id] = record; } } else { // create new _cache.Add(record.Id, record); } } catch { // ignore invalid record } } } } } }
public void Update(CheckListItem item) { if (_isStorageChanged) { RefreshCache(); } _cache[item.Id] = item; Save(); }
public static void UpdateFrom(this CheckListItem item, CheckListItemUpdate update) { item.Content = update.Content; item.IsCompleted = update.IsCompleted; }
private void BtnOpcUaAddEdit_Click(object sender, RoutedEventArgs e) { var button = sender as Button; MainForm addOpc = null; if (button != null && button.Content.ToString().ToLower() == "add") { addOpc = new MainForm(); //{ // IsEdit = false //}; } else if (button != null) { //addOpc = new MainForm() //{ // IsEdit = true //}; foreach (CheckListItem item in LstOpcUa.Items) { if (!item.IsChecked) { continue; } //addOpc.UidGuid = Guid.Parse(item.UidGuid); break; } } else { return; } var success = addOpc.ShowDialog(); if (success == System.Windows.Forms.DialogResult.OK) //true { if (button.Content.ToString().ToLower() == "add") { var configureRabbit = UserConfigureFactory(new Guid()); if (configureRabbit.HasValue && !configureRabbit.Value) //False { var listBoxItem = new ListBoxItem() { Content = "Unable to configure RabbitMQ server" }; lstErrors.Items.Add(listBoxItem); } } var opcList = new CheckListItem { //UidGuid = addOpc.UidGuid.ToString(), //Content = OpcUaServers[OpcUaServers.Length - 1].ServerUri.ToString(), IsChecked = false, ItemName = ""//; }; OpcUaList.Add(opcList); } else { var listBoxItem = new ListBoxItem { Content = $"Unable to {button.Content} OPC UA server" }; lstErrors.Items.Add(listBoxItem); } }
public void UpdateCheckListItem(CheckListItem item) { _checkListItemRepository.Update(item); }
public void Delete(CheckListItem item) { var deleteTask = _client.DeleteAsync(FormatUlr(item)); deleteTask.Wait(); }
private CheckListItem AddNew(string key, string value, bool isSelected) { var chkItem = new CheckListItem(key, value, isSelected); return(chkItem); }
string FormatUlr(CheckListItem item) { return string.Format(resourceItemUrl, item.Id); }
void EditItem(CheckListItem item) { if (item != null) { View.WindowEdit edit = new View.WindowEdit(); edit.DataContext = item.Clone(); if (edit.ShowDialog() == true) { _repository.Update(edit.DataContext as CheckListItem); } } }
protected bool Equals(CheckListItem other) { return(base.Equals(other) && Checked == other.Checked); }
public void Add(CheckListItem item) { var postTask = _client.PostAsJsonAsync(resourceUrl, item); postTask.Wait(); }
bool IsCanEditItem(CheckListItem item) { return _selectedItem != null; }
public void Update(CheckListItem item) { var updateTask = _client.PutAsJsonAsync(FormatUlr(item), item); updateTask.Wait(); }
public void FireWorkItemCheckListItemAdded(WorkItem wi, CheckListItem cli) { var eventArgs = new AppEventArgs(AppAction.CHECKLIST_ITEM_ADDED, wi, cli); appEvent?.Invoke(this, eventArgs); }
/// <summary> /// Proivdes a threadsafe way to close the serial ports /// </summary> /// <param name="index"> /// Index for Dynamic Server Allocation /// </param> public static void CloseSerialPortUnexpectedly(int index, Dispatcher uiDispatcher) { if (!SerialPorts[index].IsOpen) { return; } while (SerialPorts[index].IsOpen) { SerialPorts[index].Close(); } uiDispatcher.Invoke((MethodInvoker) delegate { ; var i = 0; i += AvailableSerialPorts.TakeWhile(e => Guid.Parse(e.UidGuid) == SerialCommunications[index].UidGuid) .Count(); if (i > (AvailableSerialPorts.Count - 1)) { i = 0; i += AvailableModbusSerialPorts .TakeWhile(e => Guid.Parse(e.UidGuid) == SerialCommunications[index].UidGuid) .Count(); if (i > (AvailableModbusSerialPorts.Count - 1)) { throw new NullReferenceException(); } var checklistItem = new CheckListItem { IsChecked = false, Content = AvailableModbusSerialPorts[i].Content, ItemName = AvailableModbusSerialPorts[i].ItemName, UidGuid = AvailableModbusSerialPorts[i].UidGuid }; AvailableModbusSerialPorts.RemoveAt(i); AvailableModbusSerialPorts.Insert(i, checklistItem); } else { var checkListItem = new CheckListItem { Content = AvailableSerialPorts[i].Content, IsChecked = false, ItemName = AvailableSerialPorts[i].ItemName, UidGuid = AvailableSerialPorts[i].UidGuid }; AvailableSerialPorts.RemoveAt(i); AvailableSerialPorts.Insert(i, checkListItem); } MessageBox.Show( @"Error with Serial Port. Closing connection. Please check settings and connection and try again.", @"Serial Port Error", MessageBoxButtons.OK, MessageBoxIcon.Error); }); SerialPorts = RemoveAtIndex <SerialPort>(index, SerialPorts); SerialCommunications = RemoveAtIndex <SerialCommunication>(index, SerialCommunications); StatsGroupings = RemoveAtIndex <int>(index, StatsGroupings); ServerInformation = RemoveAtIndex <RabbitServerInformation>(index, ServerInformation); Lineseries = RemoveAtIndex <LineSeries>(index, Lineseries); while (FactoryChannel[index].IsOpen) { FactoryChannel[index].Close(); } while (FactoryConnection[index].IsOpen) { FactoryConnection[index].Close(); } FactoryChannel = RemoveAtIndex <IModel>(index, FactoryChannel); FactoryConnection = RemoveAtIndex <IConnection>(index, FactoryConnection); Factory = RemoveAtIndex <IConnectionFactory>(index, Factory); }
private void FireWorkItemCheckListItemSelected(WorkItem wi, CheckListItem cli) { var eventArgs = new AppEventArgs(AppAction.CHECKLIST_ITEM_SELECTED, wi, cli); appEvent?.Invoke(this, eventArgs); }
public void Update(CheckListItem item) { throw new NotImplementedException(); }
public void FireCheckListItemMoved(CheckListItem cli, bool moveUp) { var eventArgs = new AppEventArgs(AppAction.CHECKLIST_ITEM_MOVED, SelectedWorkItem, cli, (Object)moveUp); appEvent?.Invoke(this, eventArgs); }
public void Delete(CheckListItem checkListItem) { _connection.Delete(checkListItem); }
public void DeleteItem(CheckListItem item) { _notification.CancelNotification(item); _repository.Delete(item); _messenger.Publish(new DataChangeMessage(this)); }
public Guid CreateCheckListItem(CheckListItem item) { throw new NotImplementedException(); }
public void UpdateItem(CheckListItem item) { _repository.Update(item); _notification.ScheduleNotification(item); _messenger.Publish(new DataChangeMessage(this)); }
public void CreateCheckListItem(CheckListItem item) { _checkListItemRepository.Add(item); }
public HttpResponseMessage InsertUpdateCheckListItems([FromBody] CheckListItem Data) { List <CheckListOptions> checkListOption = JsonConvert.DeserializeObject <List <CheckListOptions> >(Data.OptionData); return(Request.CreateResponse(HttpStatusCode.OK, adminBL.InsertUpdateCheckListItems(Data.ChecklistItemId, Data.CheckListItemName, Data.CheckListControlType, Data.ChecklistType, Data.UserID, Data.isActive, checkListOption))); }