Beispiel #1
0
        private void dataList_DoubleClick(object sender, EventArgs e)
        {
            if (this.dataList.SelectedItems != null && dataList.SelectedItems.Count > 0)
            {
                SnDataSet      dataset = (SnDataSet)dataList.SelectedItems[0].Tag;
                FormDataSource form    = new FormDataSource();
                form.UseType            = dataset.DataSetType.GetHashCode();
                form.DataSetID          = dataset.DataSetID;
                form.DataSetChineseName = dataset.DataSetName;
                form.ReportPath         = dataset.ReportPath;
                if (form.ShowDialog() == DialogResult.OK)
                {
                    bool hasPage = false;

                    foreach (ListViewItem item in dataList.Items)
                    {
                        if (item.SubItems[2].Text == "Page")
                        {
                            hasPage = false;
                            break;
                        }
                    }
                    if (hasPage && ((DataSetType)form.UseType).ToString() == "Page")
                    {
                        MessageBox.Show("每一个数据集合只能有一个用查询的Page数据集!", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                    dataset.DataSetID   = form.DataSetID;
                    dataset.DataSetName = form.DataSetChineseName;
                    dataset.DataSetType = (DataSetType)form.UseType;
                    dataset.ReportPath  = form.ReportPath;
                }
            }
        }
Beispiel #2
0
        private void menuNew_Click(object sender, EventArgs e)
        {
            FormDataSource form = new FormDataSource();

            form.UseType            = 0;
            form.DataSetID          = "dataSet" + (dataList.Items.Count + 1);
            form.DataSetChineseName = "数据集" + (dataList.Items.Count + 1);

            if (form.ShowDialog() == DialogResult.OK)
            {
                bool hasPage = false;

                foreach (ListViewItem item in dataList.Items)
                {
                    if (item.SubItems[2].Text == "Page")
                    {
                        hasPage = false;
                        break;
                    }
                }

                if (hasPage && ((DataSetType)form.UseType).ToString() == "Page")
                {
                    MessageBox.Show("每一个数据集合只能有一个用查询的Page数据集!", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                SnDataSet dataset = new SnDataSet();
                dataset.DataSetID   = form.DataSetID;
                dataset.DataSetName = form.DataSetChineseName;
                dataset.DataSetType = (DataSetType)form.UseType;
                dataset.ReportPath  = form.ReportPath;
                dataset.DataType    = "自定义";
                _currDataSet        = dataset;
                this.Solution.DataSetList.Add(dataset);
                ListViewItem listViewItem = dataList.Items.Add(dataset.DataSetID);
                listViewItem.Tag = dataset;
                listViewItem.SubItems.Add(dataset.DataSetName);
                listViewItem.SubItems.Add(dataset.DataSetType.ToString());
                listViewItem.Selected = true;
            }
        }