Inheritance: System.Windows.Forms.Form
Beispiel #1
0
        ///
        ///控件初始化
        ///

        /*
         * ITreeDataService _treeDataService = EAS.Services.ServiceContainer.GetService<ITreeDataService>();
         * //树控件初始化
         * private void tv_struct_init(){
         *  DataTable dt_root = _treeDataService.GetRootList("产品及零部件");
         *  if (dt_root.Rows.Count <= 0)
         *  {
         *      return;
         *  }
         *  this.tv_struct.Nodes.Clear();
         *  for (int i = 0; i < dt_root.Rows.Count; i++)
         *  {
         *      TreeNode root = new TreeNode(dt_root.Rows[0]["NAME"].ToString(), 0, 1);
         *      this.tv_struct_init_child(root, dt_root.Rows[0]["ID"].ToString());
         *      this.tv_struct.Nodes.Add(root);
         *      root.Expand();
         *      //this.tv_struct.SelectedNode = root;
         * }
         * }
         *
         * /// <summary>
         * /// 树控件初始化。
         * /// </summary>
         * private void tv_struct_init_child(TreeNode node, string parentId)
         * {
         *  DataTable dt_group = _treeDataService.GetGroupList(parentId);
         *  DataTable dt_module = _treeDataService.GetModelList((parentId));
         *
         *  foreach (DataRow var in dt_group.Rows) //下级组
         *  {
         *      TreeNode subNode = new TreeNode(var["Name"].ToString(), 0, 1);
         *      this.tv_struct_init_child(subNode, var["ID"].ToString());
         *      node.Nodes.Add(subNode);
         *
         *  }
         *
         *  //功能模块
         *  foreach (DataRow var in dt_module.Rows)
         *  {
         *      //Dictionary<string, int> gms = new Dictionary<string, int>();
         *      TreeNode itemNode = null;
         *      itemNode = new TreeNode(var["Name"].ToString(), 2, 2);
         *      itemNode.Tag = var["GUID"].ToString();
         *      node.Nodes.Add(itemNode);
         *      //this.tv_struct.SelectedNode = itemNode;
         *  }
         * }
         * */


        //详细查询(按钮toolDetailQuery操作)
        private void toolDetailQuery_Click(object sender, EventArgs e)
        {
            selectType s_type = 0;

            if (this.dgv_MaterialList.Visible)
            {
                s_type = selectType.Matieral;
            }
            else if (this.dgv_PartsList.Visible)
            {
                s_type = selectType.Parts;
            }
            else if (this.dgv_productList.Visible)
            {
                s_type = selectType.Product;
            }
            QueryStructForm o = new QueryStructForm(Convert.ToInt16(s_type));

            o.StartPosition = FormStartPosition.CenterParent;
            if (o.ShowDialog() == DialogResult.OK)
            {
                if (this.dgv_MaterialList.Visible)
                {
                    this.dgv_MaterialList.DataSource = m_structService.GetMaterailList(o.Materails);
                }
                else if (this.dgv_PartsList.Visible)
                {
                    this.dgv_PartsList.DataSource = m_structService.GetPartsList(o.Parts);
                }
                else if (this.dgv_productList.Visible)
                {
                    this.dgv_productList.DataSource = m_structService.GetProductList(o.Products);
                }
            }
        }
        ///
        ///控件初始化
        ///
        /*
        ITreeDataService _treeDataService = EAS.Services.ServiceContainer.GetService<ITreeDataService>();
        //树控件初始化
        private void tv_struct_init(){
            DataTable dt_root = _treeDataService.GetRootList("产品及零部件");
            if (dt_root.Rows.Count <= 0)
            {
                return;
            }
            this.tv_struct.Nodes.Clear();
            for (int i = 0; i < dt_root.Rows.Count; i++)
            {
                TreeNode root = new TreeNode(dt_root.Rows[0]["NAME"].ToString(), 0, 1);
                this.tv_struct_init_child(root, dt_root.Rows[0]["ID"].ToString());
                this.tv_struct.Nodes.Add(root);
                root.Expand();
                //this.tv_struct.SelectedNode = root;
           }
        }

        /// <summary>
        /// 树控件初始化。
        /// </summary>
        private void tv_struct_init_child(TreeNode node, string parentId)
        {
            DataTable dt_group = _treeDataService.GetGroupList(parentId);
            DataTable dt_module = _treeDataService.GetModelList((parentId));

            foreach (DataRow var in dt_group.Rows) //下级组
            {
                TreeNode subNode = new TreeNode(var["Name"].ToString(), 0, 1);
                this.tv_struct_init_child(subNode, var["ID"].ToString());
                node.Nodes.Add(subNode);

            }

            //功能模块
            foreach (DataRow var in dt_module.Rows)
            {
                //Dictionary<string, int> gms = new Dictionary<string, int>();
                TreeNode itemNode = null;
                itemNode = new TreeNode(var["Name"].ToString(), 2, 2);
                itemNode.Tag = var["GUID"].ToString();
                node.Nodes.Add(itemNode);
                //this.tv_struct.SelectedNode = itemNode;
            }
        }
         * */
        //详细查询(按钮toolDetailQuery操作)
        private void toolDetailQuery_Click(object sender, EventArgs e)
        {
            selectType s_type=0;
            if (this.dgv_MaterialList.Visible)
            {
                s_type = selectType.Matieral;
            }
            else if (this.dgv_PartsList.Visible)
            {
                s_type = selectType.Parts;
            }
            else if (this.dgv_productList.Visible)
            {
                s_type = selectType.Product;
            }
            QueryStructForm o = new QueryStructForm(Convert.ToInt16(s_type));
            o.StartPosition = FormStartPosition.CenterParent;
            if (o.ShowDialog()==DialogResult.OK) {
                if (this.dgv_MaterialList.Visible)
                {
                    this.dgv_MaterialList.DataSource = m_structService.GetMaterailList(o.Materails);
                }
                else if (this.dgv_PartsList.Visible)
                {
                    this.dgv_PartsList.DataSource = m_structService.GetPartsList(o.Parts);
                }
                else if (this.dgv_productList.Visible)
                {
                    this.dgv_productList.DataSource = m_structService.GetProductList(o.Products);
                }
            }
        }