public EditListControl(int groupId, GroupModel groupModel) { GroupId = groupId; AGroupModel = groupModel; InitializeComponent(); cmbContinuationType.Items.Clear(); cmbContinuationType.Items.Add(eTimeSeriesContinuationType.tsctNoContinuation); cmbContinuationType.Items.Add(eTimeSeriesContinuationType.tsctStandard); cmbContinuationType.Items.Add(eTimeSeriesContinuationType.tsctStandardByMonth); cmbContinuationType.Items.Add(eTimeSeriesContinuationType.tsctActive); cmbContinuationType.Items.Add(eTimeSeriesContinuationType.tsctActiveByMonth); cmbContinuationType.Items.Add(eTimeSeriesContinuationType.tsctAdjusted); cmbContinuationType.Items.Add(eTimeSeriesContinuationType.tsctAdjustedByMonth); }
private void EditListControl_SaveClick(object sender, EventArgs e) { var mList = _editListControl.checkedListBox_rd.CheckedItems.Cast<String>(); var enumerable = mList as IList<string> ?? mList.ToList(); var weekDays = enumerable.Aggregate<string, string>(null, (current, item) => current + (item + ",")); var aList = _editListControl.GetDates(); enumerable = aList as IList<string> ?? aList.ToList(); var monthDays = enumerable.Aggregate<string, string>(null, (current, item) => current + (item + ",")); var depth = _editListControl.GetDepth(); var group = new GroupModel { GroupName = _editListControl.textBoxXListName.Text, TimeFrame = _editListControl.cmbHistoricalPeriod.SelectedItem.ToString(), Start = new DateTime().AddYears(depth).AddYears(-1), End = new DateTime(), CntType = _editListControl.cmbContinuationType.SelectedItem.ToString(), IsDaily = _editListControl.checkBoxX_repeat_dialy.Checked, IsMonthly = !_editListControl.checkBoxX_repeat_dialy.Checked, IsPart = _editListControl.checkBoxX_parttime.Checked, WeekDays = weekDays, MonthDays = monthDays, TimePeriods = _editListControl.GetTimePeriods() }; var oldGroupName = _editListControl.OldGroupName; if ((!_groups.Exists(a => a.GroupName == group.GroupName) && _groups.Exists(a => a.GroupName == oldGroupName)) || (group.GroupName == oldGroupName && _groups.Exists(a => a.GroupName == oldGroupName))) { var groupId = _groups.Find(a => a.GroupName == oldGroupName).GroupId; TickNetClientDataManager.EditGroupOfSymbols(groupId, group); var symbolsInGroup = TickNetClientDataManager.GetSymbolsInGroup(groupId); foreach (var item in _editListControl.lbSelList.Items) { if (!symbolsInGroup.Exists(a => a.SymbolName == item.ToString()) && _symbols.Exists(a => a.SymbolName == item.ToString())) { var symbol = _symbols.Find(a => a.SymbolName == item.ToString()); TickNetClientDataManager.AddSymbolIntoGroup(groupId, symbol); } } symbolsInGroup = TickNetClientDataManager.GetSymbolsInGroup(groupId); foreach (var symbol in symbolsInGroup) { var exist = false; foreach (var item in _editListControl.lbSelList.Items) { if (symbol.SymbolName == item.ToString()) exist = true; } if (!exist) TickNetClientDataManager.DeleteSymbolFromGroup(groupId, symbol.SymbolId); } RefreshGroups(); foreach (var item in ui_listBox_groups.Items) { if (item.ToString() == group.GroupName) { ui_listBox_groups.SelectedItem = item; break; } } CloseEditListControl(); } else { ToastNotification.Show(_editListControl, @"List with this name is already exists!"); } }
private void AddListControl_SaveClick(object sender, EventArgs e) { var group = new GroupModel { GroupName = _addListControl.textBoxXListName.Text, TimeFrame = _addListControl.cmbHistoricalPeriod.SelectedItem.ToString(), Start = new DateTime(), End = new DateTime(), CntType = _addListControl.cmbContinuationType.SelectedItem.ToString() }; if (!_groups.Exists(a => a.GroupName == group.GroupName) && !TickNetClientDataManager.GetAllGroups().Exists(a => a.GroupName == group.GroupName)) { if (TickNetClientDataManager.AddGroupOfSymbols(group)) { group.GroupId = TickNetClientDataManager.GetGroupIdByName(group.GroupName); TickNetClientDataManager.AddGroupForUser(_client.UserID, group); RefreshGroups(); _clientService.ServiceProxy.onSymbolGroupListRecieved(""); foreach (var item in ui_listBox_groups.Items) { if (item.ToString() == group.GroupName) { ui_listBox_groups.SelectedItem = item; break; } } CloseAddListControl(); } } else { ToastNotification.Show(_addListControl, @"List with this name is already exists!"); } }