Ejemplo n.º 1
0
        /// <summary>
        /// 加载数据
        /// </summary>
        private void LoadData()
        {
            DataTable  dataTable;
            DataColumn dc;

            grvDataList.Columns[1].OptionsColumn.AllowEdit = false;
            grvDataList.Columns[2].OptionsColumn.AllowEdit = false;
            DataSet dataDS = new DataSet();

            try
            {
                dataDS = baseAttributeCategoryEntity.GetBaseCategory();
                if (baseAttributeCategoryEntity.ErrorMsg == "")
                {
                    dataTable = dataDS.Tables[0];
                    dc        = dataTable.Columns.Add(COMMON_FIELDS.FIELD_COMMON_CHECKED, typeof(bool));

                    dc.Caption      = string.Empty;
                    dc.DefaultValue = false;

                    this.grdDataList.DataSource = dataTable;

                    this.grvDataList.BestFitColumns();
                }
                else
                {
                    MessageBox.Show(baseAttributeCategoryEntity.ErrorMsg);
                }
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.Message);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// load tree node data 载入列表数据 modi by chao.pang
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BasicDataSettingTree_Load(object sender, EventArgs e)
        {
            DataSet dataDS = new DataSet(); //dataset to receive category information

            try
            {
                //get data
                dataDS = baseAttributeCategoryEntity.GetBaseCategory();
                //check result
                if (baseAttributeCategoryEntity.ErrorMsg == "")
                {
                    //if there ara datas,initial tree 返回值dataDS中行数进行循环,获取值到节点下 modi by chao.pang
                    for (int i = 0; i < dataDS.Tables[0].Rows.Count; i++)
                    {
                        //set value to tree's node dataDS中CATEGORY_NAME列的值插到节点下 modi by chao.pang
                        tvBasicSettings.Nodes.Add(dataDS.Tables[0].Rows[i]["CATEGORY_NAME"].ToString());
                        //add tag 将节点对象对应到相应的CATEGORY_KEY值  modi by chao.pang
                        tvBasicSettings.Nodes[i].Tag = dataDS.Tables[0].Rows[i]["CATEGORY_KEY"].ToString();
                    }

                    //this.tvBasicSettings.Sort();
                }
                else
                {
                    MessageBox.Show(baseAttributeCategoryEntity.ErrorMsg);
                }
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.Message);
            }
        }