Example #1
0
            /// <summary>
            /// Возвратить таблицу с перечнем ТЭЦ
            /// </summary>
            /// <param name="err">Признак ошибки при выполнении операции</param>
            /// <returns>Таблица с данными - результат запроса</returns>
            public DataTable GetDataTableTEC(out int err)
            {
                err = _connConfigDb == null ? -1 : 0;

                if (err == 0)
                {
                    return(InitTEC_200.getListTEC(ref _connConfigDb, false, _filterListTEC, out err));
                }
                else
                {
                    return(new DataTable());
                }
            }
Example #2
0
        public FormUser(int id)
        {
            InitializeComponent();

            m_idListener = id;

            m_listUserID = new List <int> ();

            m_arUIControl       = new Control[] { textBoxUserDesc, maskedTextBoxIP, textBoxDomain, textBoxUserName, textBoxComputerName };
            m_curIndexUIControl = INDEX_UICONTROL.COUNT_INDEX_UICONTROL;

            int err = 0,
                i   = -1;

            DbConnection connConfigDB = DbSources.Sources().GetConnection(m_idListener, out err);

            HStatisticUsers.GetUsers(ref connConfigDB, @"", @"DESCRIPTION", out m_users_origin, out err);
            m_users_edit = m_users_origin.Copy();
            //m_userRows = m_users_edit.Select();

            //for (i = 0; i < m_userRows.Length; i++)
            for (i = 0; i < m_users_edit.Rows.Count; i++)
            {
                //listBoxUsers.Items.Add(m_userRows[i]["DESCRIPTION"].ToString());
                dgvUsers.Rows.Add();
                dgvUsers.Rows[i].Cells[0].Value = m_users_edit.Rows[i]["DESCRIPTION"].ToString();
                m_listUserID.Add(Convert.ToInt32(m_users_edit.Rows[i]["ID"]));
            }

            comboBoxRole.SelectedIndexChanged -= comboBoxRole_SelectedIndexChanged;

            m_listRolesID = new List <int>();
            DataTable roles;

            //roles = DbTSQLInterface.Select(m_connectionSetttings, "SELECT * FROM roles WHERE ID < 500", out err);
            HStatisticUsers.GetRoles(ref connConfigDB, @"", @"DESCRIPTION", out roles, out err);
            for (i = 0; i < roles.Rows.Count; i++)
            {
                m_listRolesID.Add(Convert.ToInt32(roles.Rows[i]["ID"]));
                comboBoxRole.Items.Add(roles.Rows[i]["DESCRIPTION"]);
            }

            comboBoxRole.SelectedIndexChanged += comboBoxRole_SelectedIndexChanged;

            m_prevComboBoxAccessSelectedIndex = -1;

            comboBoxAccess.SelectionChangeCommitted -= comboBoxAccess_SelectionChangeCommitted;

            m_listTECID = new List <int>();
            DataTable tec = InitTEC_200.getListTEC(ref connConfigDB, true, out err); //Игнорировать столбец 'InUse' - использовать

            m_listTECID.Add(0);
            comboBoxAccess.Items.Add("Все станции");

            for (i = 0; i < tec.Rows.Count; i++)
            {
                m_listTECID.Add(Convert.ToInt32(tec.Rows[i]["ID"]));
                comboBoxAccess.Items.Add(tec.Rows[i]["NAME_SHR"]);
            }

            comboBoxAccess.SelectionChangeCommitted += comboBoxAccess_SelectionChangeCommitted;

            if (dgvUsers.Rows.Count > 0)
            {
                //dgvUsers_RowSelectedChanged(0);
                dgvUsers.Rows[0].Selected = true;
            }
            else
            {
                ;
            }

            buttonUserAdd.Enabled = false;

            dgvUsers.RowEnter += new DataGridViewCellEventHandler(dgvUsers_RowEnter);

            //DbTSQLInterface.CloseConnection(InitTEC.m_connConfigDB, out err);
        }