Ejemplo n.º 1
0
        public EditListControl(int groupId, GroupModel groupModel)
        {
            GroupId = groupId;
            AGroupModel = groupModel;

            InitializeComponent();
        }
Ejemplo n.º 2
0
        public static bool AddGroupOfSymbols(GroupModel group)
        {
            string startDateStr = Convert.ToDateTime(group.Start).ToString("yyyy/MM/dd HH:mm:ss", CultureInfo.InvariantCulture);
            string endDateStr = Convert.ToDateTime(group.End).ToString("yyyy/MM/dd HH:mm:ss", CultureInfo.InvariantCulture);

            String query = "INSERT IGNORE INTO " + TblSymbolsGroups;
            query += " (GroupName, TimeFrame, Start, End, CntType) VALUES";
            query += "('" + group.GroupName + "',";
            query += " '" + group.TimeFrame + "',";
            query += " '" + startDateStr + "',";
            query += " '" + endDateStr + "',";
            query += " '" + group.CntType + "');COMMIT;";
            return DoSql(query);
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        public static bool AddGroupForUser(int userId, GroupModel group)
        {
            string startDateStr = Convert.ToDateTime(group.Start).ToString("yyyy/MM/dd HH:mm:ss", CultureInfo.InvariantCulture);
            string endDateStr = Convert.ToDateTime(group.End).ToString("yyyy/MM/dd HH:mm:ss", CultureInfo.InvariantCulture);

            var sql = "INSERT IGNORE INTO " + TblGroupsForUsers
                      + " (`UserID`, `GroupID`, `GroupName`, `TimeFrame`, `Start`, `End`, `CntType`, `Privilege`, `AppType`)"
                      + "VALUES('" + userId + "',"
                      + " '" + group.GroupId + "',"
                      + " '" + group.GroupName + "',"
                      + " '" + group.TimeFrame + "',"
                      + " '" + startDateStr + "',"
                      + " '" + endDateStr + "',"
                      + " '" + group.CntType + "',"
                      + " '" + group.Privilege.ToString() + "',"
                      + " '" + group.AppType.ToString() + "');COMMIT;";

            return DoSql(sql);
        }
Ejemplo n.º 5
0
        public FormAddSymbolsGroups(int userID, int groupID = -1)
        {
            InitializeComponent();
            if (groupID == -1)
            {

                _userID = userID;
                _symbols = ClientDatabaseManager.GetSymbols(_userID, false);
                _groups = ClientDatabaseManager.GetGroupsForUser(_userID, ApplicationType.DataNet);
            }
            else
            {
                _groupID = groupID;
                _userID = userID;
                _group = ClientDatabaseManager.GetGroups(_userID, ApplicationType.DataNet).Find(oo => oo.GroupId == groupID);
                _symbols = ClientDatabaseManager.GetSymbols(_userID, false);
                _isSingleGroup = true;
            }
        }
Ejemplo n.º 6
0
        private static void AddGroup(GroupModel group)
        {
            var groupValues = new ArrayList
                        {
                            _groupIndexer,
                            _userIndexer,
                            group.GroupName,
                            group.TimeFrame,
                            group.CntType,
                            group.AppType.ToString(),
                            group.Privilege
                        };

            var groupRow = _userDetails.tableGroups.NewRow();

            groupRow.ItemArray = groupValues.ToArray();
            _userDetails.tableGroups.Rows.Add(groupRow);
            _userDetails.AcceptChanges();
        }
Ejemplo n.º 7
0
        private static void AddGroupSymbols(GroupModel group)
        {
            var symbolList = AdminDatabaseManager.GetSymbolsInGroup(group.GroupId);

            foreach (var symbol in symbolList)
            {
                var symbolValues = new ArrayList
                    {
                        null,
                        _groupIndexer,
                        symbol.SymbolName
                    };

                var symbolRow = _userDetails.tableSymbols.NewRow();

                symbolRow.ItemArray = symbolValues.ToArray();
                _userDetails.tableSymbols.Rows.Add(symbolRow);
                _userDetails.AcceptChanges();
            }
        }
Ejemplo n.º 8
0
        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 (group.GroupName == "")
            {
                ToastNotification.Show(_addListControl, @"Please enter name of the list", eToastPosition.TopCenter);
            }
            else if (!_groups.Exists(a => a.GroupName == group.GroupName))
            {
                if (AdminDatabaseManager.AddGroupOfSymbols(group))
                {
                    UpdateGroupsTable();

                    var groupId = _groups.Find(a => a.GroupName == group.GroupName).GroupId;
                    foreach (var item in _addListControl.lbSelList.Items)
                    {
                        if (_symbols.Exists(a => a.SymbolName == item.ToString()))
                        {
                            var symbol = _symbols.Find(a => a.SymbolName == item.ToString());
                            AdminDatabaseManager.AddSymbolIntoGroup(groupId, symbol);
                        }
                    }
                    _adminService.GroupChanged();
                    for (var index = 0; index < ui_groups_dataGridViewX_groupsList.Rows.Count; index++)
                    {
                        var item = ui_groups_dataGridViewX_groupsList.Rows[index];
                        ui_groups_dataGridViewX_groupsList.Rows[index].Selected = item.Cells[0].Value.ToString() == @group.GroupName;
                    }

                    CloseAddListControl();
                }
            }
            else
            {
                ToastNotification.Show(_addListControl, @"List with this name is already exists!", eToastPosition.TopCenter);
            }
        }
Ejemplo n.º 9
0
        public static bool AddGroupForUser(int userId, GroupModel group, ApplicationType appType)
        {
            var startDateStr = Convert.ToDateTime(group.Start).ToString("yyyy/MM/dd HH:mm:ss", CultureInfo.InvariantCulture);
            var endDateStr = Convert.ToDateTime(group.End).ToString("yyyy/MM/dd HH:mm:ss", CultureInfo.InvariantCulture);

            var sql = "INSERT IGNORE INTO " + TblGroupsForUsers
                      + " (`UserID`, `GroupID`, `GroupName`, `TimeFrame`, `Start`, `End`, `CntType`, `Privilege`, `AppType`,`IsAutoModeEnabled`,`Depth`)"
                      + "VALUES('" + userId + "',"
                      + " '" + group.GroupId + "',"
                      + " '" + group.GroupName + "',"
                      + " '" + group.TimeFrame + "',"
                      + " '" + startDateStr + "',"
                      + " '" + endDateStr + "',"
                      + " '" + group.CntType + "',"
                      + " '" + GroupPrivilege.Creator + "',"
                      + " '" + appType.ToString() + "',"
                      + " " + (group.IsAutoModeEnabled ? "1" : "0") + ","
                      + " " + group.Depth + ""
                      + ");COMMIT;";

            return DoSql(sql);
        }
Ejemplo n.º 10
0
        public static List<GroupModel> GetGroups()
        {
            var groupList = new List<GroupModel>();

            const string sql = "SELECT * FROM " + TblSymbolsGroups;
            lock (LockReader)
            {
                var reader = GetReader(sql);
                if (reader != null)
                {
                    while (reader.Read())
                    {
                        var group = new GroupModel
                        {
                            GroupId = reader.GetInt32(0),
                            GroupName = reader.GetString(1),
                            TimeFrame = reader.GetString(2),
                            Start = reader.GetDateTime(3),
                            End = reader.GetDateTime(4),
                            CntType = reader.GetString(5)
                        };

                        groupList.Add(group);
                    }

                    reader.Close();
                }
            }
            return groupList;
        }
Ejemplo n.º 11
0
        public static List<GroupModel> GetGroupsForUser(int userId)
        {
            var groupList = new List<GroupModel>();

            var sql = "SELECT * FROM " + TblGroupsForUsers + " WHERE UserID = '" + userId + "' ; ";
            lock (LockReader)
            {
                var reader = GetReader(sql);
                if (reader != null)
                {
                    while (reader.Read())
                    {
                        var symbol = new GroupModel
                        {
                            GroupId = reader.GetInt32(2),
                            GroupName = reader.GetString(3),
                            TimeFrame = reader.GetString(4),
                            Start = reader.GetDateTime(5),
                            End = reader.GetDateTime(6),
                            CntType = reader.GetString(7)
                        };

                        GroupPrivilege privilege;
                        ApplicationType appType;
                        Enum.TryParse(reader.GetString(8), out privilege);
                        Enum.TryParse(reader.GetString(9), out appType);

                        symbol.Privilege = privilege;
                        symbol.AppType = appType;

                        groupList.Add(symbol);
                    }
                    reader.Close();
                }
            }
            return groupList;
        }
Ejemplo n.º 12
0
        public static List<GroupModel> GetGroupsForUser(int userId, ApplicationType appType)
        {
            var groupList = new List<GroupModel>();

            string sql = "SELECT * FROM " + TblGroupsForUsers + " WHERE UserID = '" + userId + "' AND AppType = '" + appType.ToString() + "' ORDER BY GroupName " + (SortingModeIsAsc ? "ASC" : "DESC");
            var reader = GetReader(sql);
            if (reader != null)
            {
                while (reader.Read())
                {
                    var symbol = new GroupModel
                    {
                        GroupId = reader.GetInt32(2),
                        GroupName = reader.GetString(3),
                        TimeFrame = reader.GetString(4),
                        Start = reader.GetDateTime(5),
                        End = reader.GetDateTime(6),
                        CntType = reader.GetString(7),
                        Depth = reader.GetInt32("Depth"),
                        IsAutoModeEnabled = reader.GetBoolean("IsAutoModeEnabled")
                    };

                    GroupPrivilege privilege;
                    ApplicationType appType1;
                    Enum.TryParse(reader.GetString(8), out privilege);
                    Enum.TryParse(reader.GetString(9), out appType1);

                    symbol.Privilege = privilege;
                    symbol.AppType = appType1;

                    groupList.Add(symbol);
                }
                reader.Close();
            }
            return groupList;
        }
Ejemplo n.º 13
0
        public static bool EditGroupOfSymbols(int groupId, GroupModel group)
        {
            string startDateStr = Convert.ToDateTime(group.Start).ToString("yyyy/MM/dd HH:mm:ss", CultureInfo.InvariantCulture);
            string endDateStr = Convert.ToDateTime(group.End).ToString("yyyy/MM/dd HH:mm:ss", CultureInfo.InvariantCulture);

            String query = "UPDATE " + TblSymbolsGroups
                        + " SET GroupName = '" + group.GroupName
                        + "', TimeFrame = '" + group.TimeFrame
                        + "', Start = '" + startDateStr
                        + "', End = '" + endDateStr
                        + "', CntType = '" + group.CntType
                        + "' WHERE ID = '" + groupId + "' ; COMMIT;";

            if (DoSql(query))
            {
                query = "UPDATE " + TblGroupsForUsers
                    + " SET GroupName = '" + group.GroupName
                    + "', TimeFrame = '" + group.TimeFrame
                    + "', Start = '" + startDateStr
                    + "', End = '" + endDateStr
                    + "', CntType = '" + group.CntType
                    + "' WHERE GroupID = '" + groupId + "' ; COMMIT;";

                return DoSql(query);
            }

            return false;
        }
Ejemplo n.º 14
0
        public static List<GroupModel> GetGroups(int userId, ApplicationType appType)
        {
            //if (!CurrentDbIsShared) return GetAllGroups();

            var groupList = new List<GroupModel>();

            string sql = DAQueryBuilder.GetGroups(userId, appType, SortingModeIsAsc);

            var reader = GetReader(sql);
            if (reader != null)
            {
                while (reader.Read())
                {
                    var group = new GroupModel
                    {
                        GroupId = reader.GetInt32(2),
                        GroupName = reader.GetString(3),
                        TimeFrame = reader.GetString(4),
                        Start = reader.GetDateTime(5),
                        End = reader.GetDateTime(6),
                        CntType = reader.GetString(7),
                    };

                    GroupPrivilege privilege;
                    ApplicationType appType1;
                    Enum.TryParse(reader.GetString(8), out privilege);
                    Enum.TryParse(reader.GetString(9), out appType1);

                    group.Privilege = privilege;
                    group.AppType = appType1;

                    groupList.Add(group);
                }
                reader.Close();
            }
            return groupList;
        }
Ejemplo n.º 15
0
 public static bool AddGroupOfSymbols(GroupModel group)
 {
     return DoSql(DAQueryBuilder.GetAddGroupSql(group));
 }
Ejemplo n.º 16
0
        private void buttonGroupADD_Click(object sender, EventArgs e)
        {
            if (_symbolsList.Count == 0)
            {
                if (textBoxGroupsFilter.Text == "" || textBoxGroupsFilter.Text.Contains(" ")) return;
                if (comboBoxConType.SelectedItem == null) return;
                if (comboBoxTF.SelectedItem == null) return;
                var groups = ClientDatabaseManager.GetGroupsForUser(_userID, ApplicationType.DataNet);
                var group = new GroupModel
                {
                    GroupName = textBoxGroupsFilter.Text,
                    TimeFrame = comboBoxTF.SelectedItem.ToString(),
                    Start = new DateTime(),
                    End = new DateTime(),
                    CntType = comboBoxConType.SelectedItem.ToString(),
                    IsAutoModeEnabled = false,

                };
                if (!groups.Exists(oo => oo.GroupName == group.GroupName) &&
                    !ClientDatabaseManager.GetAllGroups(ApplicationType.DataNet)
                        .Exists(a => a.GroupName == group.GroupName))
                {

                    if (ClientDatabaseManager.AddGroupOfSymbols(group))
                    {
                        group.GroupId = ClientDatabaseManager.GetGroupIdByName(group.GroupName);
                        ClientDatabaseManager.AddGroupForUser(_userID, group, ApplicationType.DataNet);
                        _groups = ClientDatabaseManager.GetGroupsForUser(_userID, ApplicationType.DataNet);

                        //todo ClientServiceProxy

                        ListViewItem item = new ListViewItem(group.GroupName);
                        item.SubItems.Add(group.TimeFrame);
                        item.SubItems.Add(group.CntType);
                        item.SubItems.Add(group.GroupId.ToString());
                        listViewGroups.Items.Add(item);
                    }
                }
                else
                {
                    ToastNotification.Show(this, "This group alredy exist");
                }

            }
            else
            {
                if (textBoxGroupsFilter.Text == "" || textBoxGroupsFilter.Text.Contains(" "))
                {
                    ToastNotification.Show(this, @"Please, enter group name");
                    return;
                }
                if (comboBoxTF.SelectedItem == null)
                {
                    ToastNotification.Show(this, @"Please, chose TF");
                    return;
                }
                var groups = ClientDatabaseManager.GetGroupsForUser(_userID, ApplicationType.DataNet);
                var conType = eTimeSeriesContinuationType.tsctNoContinuation.ToString();
                if (_isStandart)
                {
                    conType = eTimeSeriesContinuationType.tsctStandard.ToString();
                }

                var group = new GroupModel
                {
                    GroupName = textBoxGroupsFilter.Text,
                    TimeFrame = comboBoxTF.SelectedItem.ToString(),
                    Start = new DateTime(),
                    End = new DateTime(),
                    CntType = conType,
                    IsAutoModeEnabled = false,

                };
                if (!groups.Exists(oo => oo.GroupName == group.GroupName) &&
                    !ClientDatabaseManager.GetAllGroups(ApplicationType.DataNet)
                        .Exists(a => a.GroupName == group.GroupName))
                {

                    if (ClientDatabaseManager.AddGroupOfSymbols(group))
                    {
                        group.GroupId = ClientDatabaseManager.GetGroupIdByName(group.GroupName);
                        ClientDatabaseManager.AddGroupForUser(_userID, group, ApplicationType.DataNet);
                        _groups = ClientDatabaseManager.GetGroupsForUser(_userID, ApplicationType.DataNet);

                        //todo ClientServiceProxy

                        ListViewItem item = new ListViewItem(group.GroupName);
                        item.SubItems.Add(group.TimeFrame);
                        item.SubItems.Add(group.CntType);
                        item.SubItems.Add(group.GroupId.ToString());
                        listViewGroups.Items.Add(item);
                        for (int i = 0; i < _symbolsList.Count; i++)
                        {
                            var currSmb = _symbolsList[i];
                            var currSmbId = _symbols.Find(a => a.SymbolName == currSmb).SymbolId;
                            //var currGroupName = group.GroupName;
                            var currGrp = group;
                            var currGroupId = currGrp.GroupId;
                            var sModel = new SymbolModel { SymbolId = currSmbId, SymbolName = currSmb };

                            if (GetCntTypeOfSymbol(currSmb) == currGrp.CntType)
                            {
                                ClientDatabaseManager.AddSymbolIntoGroup(currGroupId, sModel);
                            }
                        }
                        _symbolsList.Clear();
                        buttonCopy.Text = "Copy";
                    }
                    else
                    {
                        ToastNotification.Show(this, "This group alredy exist");
                    }
                }
            }
            textBoxGroupsFilter.Text = "";
        }
Ejemplo n.º 17
0
        public static List<GroupModel> GetAllGroups(ApplicationType appType)
        {
            var groupList = new List<GroupModel>();

            string sql = "SELECT * FROM " + TblGroups + " ORDER BY GroupName " + (SortingModeIsAsc ? "ASC" : "DESC");

            var reader = GetReader(sql);
            if (reader != null)
            {
                while (reader.Read())
                {
                    var group = new GroupModel
                    {
                        GroupId = reader.GetInt32(0),
                        GroupName = reader.GetString(1),
                        TimeFrame = reader.GetString(2),
                        Start = reader.GetDateTime(3),
                        End = reader.GetDateTime(4),
                        CntType = reader.GetString(5),
                        AppType = appType,
                        Privilege = GroupPrivilege.Creator
                    };

                    groupList.Add(group);
                }

                reader.Close();
            }
            return groupList;
        }
Ejemplo n.º 18
0
        private void EditListControl_SaveClick(object sender, EventArgs e)
        {
            var group = new GroupModel
            {
                GroupName = _editListControl.textBoxXListName.Text,
                TimeFrame = _editListControl.cmbHistoricalPeriod.SelectedItem.ToString(),
                Start = new DateTime(),
                End = new DateTime(),
                CntType = _editListControl.cmbContinuationType.SelectedItem.ToString(),
                IsAutoModeEnabled = _editListControl.checkBox_AutoCollec.Checked,
            };

            var oldGroupName = _editListControl.OldGroupName;

            if ((!_groupItems.Exists(a => a.GroupModel.GroupName == group.GroupName) &&
                 _groupItems.Exists(a => a.GroupModel.GroupName == oldGroupName)) ||
                (group.GroupName == oldGroupName && _groupItems.Exists(a => a.GroupModel.GroupName == oldGroupName)))
            {
                var groupId = _groupItems.Find(a => a.GroupModel.GroupName == oldGroupName).GroupModel.GroupId;
                ClientDatabaseManager.EditGroupOfSymbols(groupId, group);
                var symbolsInGroup = ClientDatabaseManager.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());
                        ClientDatabaseManager.AddSymbolIntoGroup(groupId, symbol);

                    }
                }
                var ses = ClientDatabaseManager.GetSessionsInGroup(groupId);
                //groupList4.ClearAllSession();
                //groupList4.AddSession(groupId,ses);
                symbolsInGroup = ClientDatabaseManager.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) ClientDatabaseManager.DeleteSymbolFromGroup(groupId, symbol.SymbolId);
                }

                RefreshGroups();

                CloseEditListControl();
            }
            else
            {
                ToastNotification.Show(_editListControl, @"List with this name is already exists!");
            }
        }
Ejemplo n.º 19
0
        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 (!_groupItems.Exists(a => a.GroupModel.GroupName == group.GroupName) &&
                !ClientDatabaseManager.GetAllGroups(ApplicationType.DataNet).Exists(a => a.GroupName == group.GroupName))
            {
                if (ClientDatabaseManager.AddGroupOfSymbols(group))
                {
                    group.GroupId = ClientDatabaseManager.GetGroupIdByName(group.GroupName);

                    ClientDatabaseManager.AddGroupForUser(_client.UserID, group, ApplicationType.DataNet);
                    RefreshGroups();

                    _clientService.ServiceProxy.onSymbolGroupListRecieved("");

                    CloseAddListControl();
                }
            }
            else
            {
                ToastNotification.Show(_addListControl, @"List with this name is already exists!");
            }
        }
Ejemplo n.º 20
0
 public void AddItem(GroupModel groupModel, GroupItemModel groupItems,List<SessionModel> session)
 {
     _groupModels.Add(groupModel);
     _groupItems.Add(groupItems);
     Redraw(session);
 }
Ejemplo n.º 21
0
        public void SetItem(int ind, GroupModel groupModel, GroupItemModel groupItems,List<SessionModel> session)
        {
            if (ind < panelEx1.Controls.Count && ind < _groupModels.Count  && ind < _groupItems.Count)
            {
                var item = _groupModels[ind];
                var gi = (GroupItem)(panelEx1.Controls[ind]);
                if (gi != null)
                {
                    gi.ItemName = item.GroupName;
                    gi.TimeFrame = item.TimeFrame;
                    gi.Time = item.End;
                    gi.ContType = item.CntType;
                    gi.Sessions = session;
                    //gi.ItemIsSelected = false;
                    gi.ItemIndex = ind;
                    gi.GroupID = item.GroupId;
                    gi.ItemState = _groupItems[ind].GroupState;
                    gi.Symbols = _groupItems[ind].AllSymbols;
                    gi.SetCount(_groupItems[ind].CollectedSymbols.Count, _groupItems[ind].AllSymbols.Count);
                    //gi.ItemIsAutoCollect = false;
                    //gi.ItemSelectedChanged += gi_ItemSelectedChanged;
                    //gi.ItemEditGroupClick += gi_ItemEditGroupClick;

                }
            }
            else
            {
                AddItem(groupModel, groupItems,session);
            }
        }
Ejemplo n.º 22
0
        private void EditListControl_SaveClick(object sender, EventArgs e)
        {
            var group = new GroupModel
            {
                GroupName = _editListControl.textBoxXListName.Text,
                TimeFrame = _editListControl.cmbHistoricalPeriod.SelectedItem.ToString(),
                Start = new DateTime(),
                End = new DateTime(),
                CntType = _editListControl.cmbContinuationType.SelectedItem.ToString()
            };

            var oldGroupName = _editListControl.OldGroupName;
            if (group.GroupName == "")
            {
                ToastNotification.Show(_editListControl, @"Please enter name of the list", eToastPosition.TopCenter);
            }
            else 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;
                AdminDatabaseManager.EditGroupOfSymbols(groupId, group);
                var symbolsInGroup = AdminDatabaseManager.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());
                        AdminDatabaseManager.AddSymbolIntoGroup(groupId, symbol);

                    }
                }

                symbolsInGroup = AdminDatabaseManager.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) AdminDatabaseManager.DeleteSymbolFromGroup(groupId, symbol.SymbolId);
                }

                UpdateGroupsTable();

                _adminService.GroupChanged();
                UpdateLogComponents();

                for (var index = 0; index < ui_groups_dataGridViewX_groupsList.Rows.Count; index++)
                {
                    var item = ui_groups_dataGridViewX_groupsList.Rows[index];
                    ui_groups_dataGridViewX_groupsList.Rows[index].Selected = item.Cells[0].Value.ToString() == @group.GroupName;
                }

                CloseEditListControl();
            }
            else
            {
                ToastNotification.Show(_editListControl, @"List with this name is already exists!", eToastPosition.TopCenter);
            }
        }
Ejemplo n.º 23
0
        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 (!_groupItems.Exists(a => a.GroupModel.GroupName == group.GroupName) &&
                !ClientDatabaseManager.GetAllGroups(ApplicationType.DataNet).Exists(a => a.GroupName == group.GroupName))
            {
                if (ClientDatabaseManager.AddGroupOfSymbols(group))
                {
                    group.GroupId = ClientDatabaseManager.GetGroupIdByName(group.GroupName);

                    ClientDatabaseManager.AddGroupForUser(_client.UserID, group, ApplicationType.DataNet);
                    //groupList4.GroupModels = group;
                    var symbols =
                    ClientDatabaseManager.GetSymbolsInGroup(group.GroupId).Select(oo => oo.SymbolName).ToList();
                    var sessions = ClientDatabaseManager.GetSessionsInGroup(group.GroupId);
                    var groupItem = new GroupItemModel
                    {
                        GroupModel = group,
                        GroupState = GroupState.NotInQueue,
                        AllSymbols = symbols,
                        CollectedSymbols = new List<string>(),
                    };
                    //groupList4.GroupItems = groupItem;
                    //groupList4.AddItem(group,groupItem, new List<SessionModel>());
                    RefreshGroups();

                    _clientService.ServiceProxy.onSymbolGroupListRecieved("");

                    CloseAddListControl();
                }
            }
            else
            {
                ToastNotification.Show(_addListControl, @"List with this name is already exists!");
            }
        }
Ejemplo n.º 24
0
        private void EditListControl_SaveClick(object sender, EventArgs e)
        {
            var group = new GroupModel
            {
                GroupName = _editListControl.textBoxXListName.Text,
                TimeFrame = "tick",
                Start = new DateTime(),
                End = new DateTime(),
                CntType = eTimeSeriesContinuationType.tsctNoContinuation.ToString(),
                Depth = _editListControl.GetDepth(),
                IsAutoModeEnabled = _editListControl.GetIsAutoModeEnabled(),
            };

            var oldGroupName = _editListControl.OldGroupName;

            if ((!_groupItems.Exists(a => a.GroupModel.GroupName == group.GroupName) && _groupItems.Exists(a => a.GroupModel.GroupName == oldGroupName)) || (group.GroupName == oldGroupName && _groupItems.Exists(a => a.GroupModel.GroupName == oldGroupName)))
            {
                var groupId = _groupItems.Find(a => a.GroupModel.GroupName == oldGroupName).GroupModel.GroupId;
                ClientDatabaseManager.EditGroupOfSymbols(groupId, group);
                var symbolsInGroup = ClientDatabaseManager.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());
                        ClientDatabaseManager.AddSymbolIntoGroup(groupId, symbol);

                    }
                }

                symbolsInGroup = ClientDatabaseManager.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) ClientDatabaseManager.DeleteSymbolFromGroup(groupId, symbol.SymbolId);
                }

                RefreshGroups();

                CloseEditListControl();
            }
            else
            {
                ToastNotification.Show(_editListControl, @"List with this name is already exists!");
            }
        }