Ejemplo n.º 1
0
        public void BuildOrgStructureTree()
        {
            stfOrgStructureTableAdapter dAdapt = new stfOrgStructureTableAdapter();

            dsITO.stfOrgStructureDataTable orgStTbl = new dsITO.stfOrgStructureDataTable();

            dAdapt.Fill(orgStTbl);

            string filterString = "UpDepID is NULL";

            DataRow[] orgUnit = orgStTbl.Select(filterString);

            //Отбражаем организационные единицы верхнего уровня UpDepID NULL
            for (int i = 0; i < orgUnit.Length; i++)
            {
                tvDepartments.Nodes.Add(orgUnit[i]["DepartmentID"].ToString(), orgUnit[i]["ShortName"].ToString() + " " + orgUnit[i]["Name"].ToString());
                FillTreeChild(orgUnit[i]["DepartmentID"].ToString(), tvDepartments.Nodes[0]);

            }
        }
Ejemplo n.º 2
0
        public void FillTreeChild(string parentDep, TreeNode ParentNode)
        {
            stfOrgStructureTableAdapter dAdapt = new stfOrgStructureTableAdapter();

            ITO_DAL.dsITO.stfOrgStructureDataTable orgStTbl = new dsITO.stfOrgStructureDataTable();

            dAdapt.Fill(orgStTbl);

            string filterString = "UpDepID=" + parentDep;

            DataRow[] orgUnit = orgStTbl.Select(filterString);

            //Отбражаем организационные единицы верхнего уровня UpDepID NULL
            for (int i = 0; i < orgUnit.Length; i++)
            {
                ParentNode.Nodes.Add(orgUnit[i]["DepartmentID"].ToString(), orgUnit[i]["ShortName"].ToString() + " " + orgUnit[i]["Name"].ToString());

                FillTreeChild(orgUnit[i]["DepartmentID"].ToString(), ParentNode.Nodes[i]);
            }
        }
Ejemplo n.º 3
0
        private void Form1_Load(object sender, EventArgs e)
        {
            BuildOrgStructureTree();

            //ADMethodsAccountManagement ADMethods = new ADMethodsAccountManagement();

            //UserPrincipal myUser = ADMethods.GetUser(@"druzhinin");

            //MessageBox.Show(myUser.GivenName + " " + myUser.EmailAddress);

            m_TableAdapterManager = new TableAdapterManager();
            m_TableAdapterManager.StaffTableAdapter = new StaffTableAdapter();
            m_TableAdapterManager.stfOrgStructureTableAdapter = new stfOrgStructureTableAdapter();
            m_TableAdapterManager.NewUserTableAdapter = new NewUserTableAdapter();

            m_CommonQuery = new QueriesTableAdapter();

            m_StaffTbl = new dsITO.StaffDataTable();
            m_NewUser = new dsITO.NewUserDataTable();
            m_TableAdapterManager.NewUserTableAdapter.Fill(m_NewUser);

            m_OrgStructure = new dsITO.stfOrgStructureDataTable();

            m_TableAdapterManager.StaffTableAdapter.Fill(m_StaffTbl);

            m_ITOSQLCommand = new ITODAL();

            m_ITOSQLCommand.OpenConnection("Data Source=10.15.140.2;Initial Catalog=ITO;Persist Security Info=True;User ID=evgeny;Password=ywfaggzu");

            //Заполняем ComboBox данными из базы

            //Должности
            DataTable dt = m_ITOSQLCommand.ExecuteSQLCommand("Select PositionID, Name from stfPositions");

            for (int curRow = 0; curRow < dt.Rows.Count; curRow++)
            {
                ListElement le = new ListElement(dt.Rows[curRow][0].ToString(), dt.Rows[curRow][1].ToString());
                cbPosition.Items.Add(le);

            }

            //Подразделения
            dt = m_ITOSQLCommand.ExecuteSQLCommand("Select DepartmentID, ShortName, Name from stfOrgStructure");

            for (int curRow = 0; curRow < dt.Rows.Count; curRow++)
            {
                ListElement le = new ListElement(dt.Rows[curRow][0].ToString(), dt.Rows[curRow][1].ToString() + " " + dt.Rows[curRow][2].ToString());
                cbDepartment.Items.Add(le);

            }

            //Здания
            dt = m_ITOSQLCommand.ExecuteSQLCommand("Select BuildingID, Name from stfBuildings");

            for (int curRow = 0; curRow < dt.Rows.Count; curRow++)
            {
                ListElement le = new ListElement(dt.Rows[curRow][0].ToString(), dt.Rows[curRow][1].ToString());
                cbWorkPlace.Items.Add(le);

            }

            dt = m_ITOSQLCommand.ExecuteSQLCommand("Select UserID,LastName,Name,SecondName from Staff");

            for (int curRow = 0; curRow < dt.Rows.Count; curRow++)
            {
                ListElement le = new ListElement(dt.Rows[curRow][0].ToString(), dt.Rows[curRow][1].ToString()+" "+dt.Rows[curRow][2].ToString()+" "+dt.Rows[curRow][3].ToString());
                cmbUser.Items.Add(le);

            }

            dt = m_ITOSQLCommand.ExecuteSQLCommand("Select distinct Place from Invent");

            for (int curRow = 0; curRow < dt.Rows.Count; curRow++)
            {
                cbPlace.Items.Add(dt.Rows[curRow][0].ToString());
            }

            dt = m_ITOSQLCommand.ExecuteSQLCommand("Select distinct Room from Invent");
            for (int curRow = 0; curRow < dt.Rows.Count; curRow++)
            {
                cbRoom.Items.Add(dt.Rows[curRow][0].ToString());
            }
        }