Exemplo n.º 1
0
        public Boolean Remove(FeatureDataTable item)
        {
            Boolean contained = _tables.Contains(item.TableName);

            _tables.Remove(item);
            return(contained);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Removes the first occurrence of a specific object from the <see cref="T:System.Collections.Generic.ICollection`1"/>.
 /// </summary>
 /// <returns>
 /// true if <paramref name="item"/> was successfully removed from the <see cref="T:System.Collections.Generic.ICollection`1"/>; otherwise, false. This method also returns false if <paramref name="item"/> is not found in the original <see cref="T:System.Collections.Generic.ICollection`1"/>.
 /// </returns>
 /// <param name="item">The object to remove from the <see cref="T:System.Collections.Generic.ICollection`1"/>.</param><exception cref="T:System.NotSupportedException">The <see cref="T:System.Collections.Generic.ICollection`1"/> is read-only.</exception>
 public bool Remove(FeatureDataTable item)
 {
     if (_dataTables.CanRemove(item))
     {
         _dataTables.Remove(item);
         return(true);
     }
     return(false);
 }
Exemplo n.º 3
0
        public void Remove()
        {
            DataTableCollection tbcol = _dataset[0].Tables;

            tbcol.Clear();
            /* _tables is array of DataTables defined in Setup */
            tbcol.AddRange(_tables);

            /* removing a recently added table */
            int count = tbcol.Count;

            tbcol.Remove(_tables[0]);
            Assert.Equal(count - 1, tbcol.Count);
            DataTable tbl = null;

            /* removing a null reference. must generate an Exception */
            Assert.Throws <ArgumentNullException>(() => tbcol.Remove(tbl));
            /* removing a table that is not there in collection */
            Assert.Throws <ArgumentException>(() => tbcol.Remove(new DataTable("newTable")));
        }
Exemplo n.º 4
0
        public static void Remove([NotNull] this DataTableCollection thisValue, [NotNull] params string[] names)
        {
            if (thisValue.Count == 0 || names.Length == 0)
            {
                return;
            }

            foreach (string name in names)
            {
                thisValue.Remove(name);
            }
        }
Exemplo n.º 5
0
    // <Snippet1>
    private void RemoveTables()
    {
        // Set the name of the table to test for and remove.
        string name = "Suppliers";

        // Presuming a DataGrid is displaying more than one table, get its DataSet.
        DataSet             thisDataSet = (DataSet)DataGrid1.DataSource;
        DataTableCollection tablesCol   = thisDataSet.Tables;

        if (tablesCol.Contains(name) && tablesCol.CanRemove(tablesCol[name]))
        {
            tablesCol.Remove(name);
        }
    }
Exemplo n.º 6
0
        public void Remove()
        {
            DataTableCollection tbcol = _dataset[0].Tables;

            tbcol.Clear();
            /* _tables is array of DataTables defined in Setup */
            tbcol.AddRange(_tables);

            /* removing a recently added table */
            int count = tbcol.Count;

            tbcol.Remove(_tables[0]);
            Assert.Equal(count - 1, tbcol.Count);
            DataTable tbl = null;

            /* removing a null reference. must generate an Exception */
            try
            {
                tbcol.Remove(tbl);
                Assert.False(true);
            }
            catch (Exception e)
            {
                Assert.Equal(typeof(ArgumentNullException), e.GetType());
            }
            /* removing a table that is not there in collection */
            try
            {
                tbcol.Remove(new DataTable("newTable"));
                Assert.False(true);
            }
            catch (Exception e)
            {
                Assert.Equal(typeof(ArgumentException), e.GetType());
            }
        }
Exemplo n.º 7
0
        internal void BuildIntervalTables()
        {
            string[] intervals = IntervalList();
            foreach (string interval in intervals)
            {
                NormalizeDates(interval);
            }
            // build table for each interval.
            // using interval name for table name
            for (int j = 0; j < intervals.Length; j++)
            {
                if (Tables.IndexOf(intervals[j]) >= 0)
                {
                    Tables.Remove(intervals[j]);
                }

                MultipleSeriesDataTable msTable = new MultipleSeriesDataTable(this, intervals[j]);
                Tables.Add(msTable);
            }
        }
        public IContent WritePage(ISource source, IPageData pageData, OutputData outputData)
        {
            TkDebug.AssertArgumentNull(outputData, "outputData", this);

            PageMakerUtil.AssertType(source, outputData,
                                     SourceOutputType.XmlReader, SourceOutputType.DataSet);

            if (outputData.OutputType == SourceOutputType.DataSet)
            {
                DataSet             ds     = PageMakerUtil.GetObject <DataSet>(outputData);
                DataTableCollection tables = ds.Tables;
                foreach (string tableName in fRemoveTables)
                {
                    if (tables.Contains(tableName))
                    {
                        tables.Remove(tableName);
                    }
                }
                foreach (var mapping in fTableMappings)
                {
                    if (tables.Contains(mapping.Key))
                    {
                        DataTable            table   = tables[mapping.Key];
                        DataColumnCollection columns = table.Columns;
                        foreach (string field in mapping.Value)
                        {
                            if (columns.Contains(field))
                            {
                                columns.Remove(field);
                            }
                        }
                    }
                }
            }

            using (XmlReader reader = PageMakerUtil.GetDataSetReader(outputData))
            {
                string xml = XmlUtil.GetJson(reader, Result);
                return(new SimpleContent(ContentTypeConst.JSON, xml));
            }
        }
Exemplo n.º 9
0
        private void pmbtn_Click(object sender, System.EventArgs e)
        {
            int       rowCnt, i;
            DataTable bookTable;
            DataRow   row;
            string    s1;

            if (isoTB.Text.Trim() == "")
            {
                return;
            }

            DataTableCollection tablesCol = bookdSet.Tables;

            if (tablesCol.Contains("book") && tablesCol.CanRemove(tablesCol["book"]))
            {
                tablesCol.Remove("book");
            }

            if (isoTB.Text.Trim() == "0")
            {
                sqlComm.CommandText = "SELECT book.ID, book.书名, book.文种号,  book.图书分类号, book.种次号, borrow.副本, borrow.借出时间, borrow.归还时间, borrow.续借次数, borrow.电话, borrow.Ecode AS ISO编号, borrow.中文姓名 FROM book INNER JOIN borrow ON book.文种号 = borrow.文种号 AND book.种次号 = borrow.种次号 AND book.图书分类号 = borrow.图书分类号 WHERE (borrow.Ecode = '" + isoTB.Text.Trim() + "') AND (borrow.实际归还时间 IS NULL) AND (归还时间<'" + System.DateTime.Now.ToString() + "')  AND (borrow.中文姓名 = '" + nmTB.Text.Trim() + "')";

                sqlDataAdap.SelectCommand = sqlComm;
                sqlDataAdap.Fill(bookdSet, "book");

                bookDG.CaptionText = "查询人员:(" + isoTB.Text.Trim().ToUpper() + ")";

                dv.Table = bookdSet.Tables["book"];

                this.bookDG.DataSource = dv;
                return;
            }

            //sqlhrComm.CommandText="SELECT employees.ecode, employees.ecname, codeorgs.cdptname FROM employees INNER JOIN codeorgs ON employees.dept = codeorgs.dptno WHERE (employees.ecode = '"+isoTB.Text.Trim()+"')";

            //sqlhrConn.Open();
            //sqldr=sqlhrComm.ExecuteReader();

            OracleComm.CommandText = "select v_sys_psn.psncode, v_sys_psn.psnname, v_sys_dept.first_deptname, v_sys_dept.second_deptname, v_sys_dept.third_deptname, v_sys_psn.mobile, v_sys_psn.officephone, v_sys_corp.UNITNAME from v_sys_psn LEFT OUTER JOIN V_SYS_DEPT ON v_sys_psn.pk_deptdoc = v_sys_dept.pk_fourtdept  LEFT OUTER JOIN v_sys_corp ON v_sys_psn.PK_CORP=v_sys_corp.PK_CORP where v_sys_psn.psncode=N'" + isoTB.Text.Trim().PadLeft(5, '0') + "' ";//写好想执行的Sql语句
            OracleConn.Open();
            odr = OracleComm.ExecuteReader();

            if (odr.Read())
            {
                booktv.BeginUpdate();
                booktv.Nodes.Clear();

                TreeNode rootNode1 = new TreeNode("所借图书", 5, 5);
                booktv.Nodes.Add(rootNode1);

                TreeNode rootNode = new TreeNode("人员信息");
                booktv.Nodes.Add(rootNode);

                s1 = odr.GetValue(1).ToString();

                TreeNode tnBook1 = new TreeNode("姓名:" + odr.GetValue(1).ToString());
                rootNode.Nodes.Add(tnBook1);
                TreeNode tnBook2 = new TreeNode("部门:" + odr.GetValue(7).ToString() + "-" + odr.GetValue(2).ToString() + "-" + odr.GetValue(3).ToString() + "-" + odr.GetValue(4).ToString());
                rootNode.Nodes.Add(tnBook2);
                TreeNode tnBook3 = new TreeNode("电话:" + odr.GetValue(5).ToString() + "  " + odr.GetValue(6).ToString());
                rootNode.Nodes.Add(tnBook3);

                booktv.EndUpdate();
                rootNode.Expand();

                //sqldr.Close();
                //sqlhrConn.Close();
                odr.Close();
                OracleConn.Close();


                sqlComm.CommandText = "SELECT book.ID, book.书名, book.文种号,  book.图书分类号, book.种次号, borrow.副本, borrow.借出时间, borrow.归还时间, borrow.续借次数, borrow.电话, borrow.Ecode AS ISO编号 FROM book INNER JOIN borrow ON book.文种号 = borrow.文种号 AND book.种次号 = borrow.种次号 AND book.图书分类号 = borrow.图书分类号 WHERE (borrow.Ecode = '" + isoTB.Text.Trim() + "') AND (borrow.实际归还时间 IS NULL) AND (归还时间<'" + System.DateTime.Now.ToString() + "')";

                sqlDataAdap.SelectCommand = sqlComm;
                sqlDataAdap.Fill(bookdSet, "book");

                bookDG.CaptionText = "查询人员:(" + isoTB.Text.Trim().ToUpper() + ")";

                dv.Table = bookdSet.Tables["book"];

                this.bookDG.DataSource = dv;
            }
            else
            {
                MessageBox.Show("没有该人员!");
                odr.Close();
                OracleConn.Close();
            }
        }
Exemplo n.º 10
0
        private void bmbtn_Click(object sender, System.EventArgs e)
        {
            int       rowCnt, i;
            DataTable bookTable;
            DataRow   row;
            string    s1;

            if (wzhTB.Text.Trim() == "" || tsflhTB.Text.Trim() == "" || zchTB.Text.Trim() == "")
            {
                return;
            }

            DataTableCollection tablesCol = bookdSet.Tables;

            if (tablesCol.Contains("book") && tablesCol.CanRemove(tablesCol["book"]))
            {
                tablesCol.Remove("book");
            }


            sqlComm.CommandText = "SELECT ID, 书名, 第一责任者, 出版者, 借出书量, 借出次数, 馆藏量 FROM book WHERE (文种号 = N'" + wzhTB.Text.Trim().ToUpper() + "') AND (图书分类号 = N'" + tsflhTB.Text.Trim().ToUpper() + "') AND (种次号 = N'" + zchTB.Text.Trim().ToUpper() + "')";

            sqlConn.Open();
            sqldr = sqlComm.ExecuteReader();

            if (sqldr.Read())
            {
                booktv.BeginUpdate();
                booktv.Nodes.Clear();

                TreeNode rootNode = new TreeNode("图书信息");
                booktv.Nodes.Add(rootNode);

                TreeNode tnBook1 = new TreeNode("书名:" + sqldr.GetValue(1).ToString());
                rootNode.Nodes.Add(tnBook1);
                TreeNode tnBook2 = new TreeNode("第一责任者:" + sqldr.GetValue(2).ToString());
                rootNode.Nodes.Add(tnBook2);
                TreeNode tnBook3 = new TreeNode("出版者:" + sqldr.GetValue(3).ToString());
                rootNode.Nodes.Add(tnBook3);
                TreeNode tnBook4 = new TreeNode("借出书量:" + sqldr.GetValue(4).ToString() + "  借出次数:" + sqldr.GetValue(5).ToString() + "  馆藏量:" + sqldr.GetValue(6).ToString());
                rootNode.Nodes.Add(tnBook4);

                booktv.EndUpdate();
                rootNode.Expand();

                sqldr.Close();
                sqlConn.Close();

                sqlComm.CommandText = "SELECT 借出时间, 归还时间,续借次数, 电话, Ecode AS ISO编号,副本,中文姓名 FROM borrow WHERE (文种号 = N'" + wzhTB.Text.Trim().ToUpper() + "') AND (图书分类号 = N'" + tsflhTB.Text.Trim().ToUpper() + "') AND (种次号 = N'" + zchTB.Text.Trim().ToUpper() + "') AND (实际归还时间 IS NULL) AND (归还时间<'" + System.DateTime.Now.ToString() + "')";

                sqlDataAdap.SelectCommand = sqlComm;
                sqlDataAdap.Fill(bookdSet, "book");

                bookDG.CaptionText = "查询图书:(" + wzhTB.Text.Trim().ToUpper() + " " + tsflhTB.Text.Trim().ToUpper() + " " + zchTB.Text.Trim().ToUpper() + ")";

                dv.Table = bookdSet.Tables["book"];

                dv.Table.Columns.Add("姓名");
                dv.Table.Columns.Add("部门");


                for (rowCnt = 0; rowCnt < dv.Table.Rows.Count; rowCnt++)
                {
                    row = dv.Table.Rows[rowCnt];

                    s1 = row["ISO编号"].ToString().Trim();

                    if (s1 != "0")
                    {
                        //sqlhrComm.CommandText="SELECT employees.ecode, employees.ecname, codeorgs.cdptname FROM employees INNER JOIN codeorgs ON employees.dept = codeorgs.dptno WHERE (employees.ecode = '"+s1+"')";

                        //sqlhrConn.Open();
                        //sqldr=sqlhrComm.ExecuteReader();

                        //sqldr.Read();


                        //if(sqldr.HasRows)
                        //{

                        //    row["姓名"]=sqldr.GetValue(1).ToString();
                        //    row["部门"]=sqldr.GetValue(2).ToString();
                        //}


                        //sqlhrConn.Close();
                        //sqldr.Close();

                        OracleComm.CommandText = "select v_sys_psn.psncode, v_sys_psn.psnname, v_sys_dept.first_deptname, v_sys_dept.second_deptname, v_sys_dept.third_deptname, v_sys_psn.mobile, v_sys_psn.officephone, v_sys_corp.UNITNAME from v_sys_psn LEFT OUTER JOIN V_SYS_DEPT ON v_sys_psn.pk_deptdoc = v_sys_dept.pk_fourtdept  LEFT OUTER JOIN v_sys_corp ON v_sys_psn.PK_CORP=v_sys_corp.PK_CORP where v_sys_psn.psncode=N'" + s1.PadLeft(5, '0') + "' ";//写好想执行的Sql语句
                        OracleConn.Open();
                        odr = OracleComm.ExecuteReader();

                        if (odr.HasRows)
                        {
                            odr.Read();
                            row["姓名"] = odr.GetValue(1).ToString();
                            row["部门"] = odr.GetValue(7).ToString() + "-" + odr.GetValue(2).ToString() + "-" + odr.GetValue(3).ToString() + "-" + odr.GetValue(4).ToString();
                        }
                        odr.Close();
                        OracleConn.Close();
                    }
                }
                this.bookDG.DataSource = dv;
            }
            else
            {
                MessageBox.Show("没有该图书!");
                sqlConn.Close();
            }
        }
Exemplo n.º 11
0
        private void maturebtn_Click_1(object sender, System.EventArgs e)
        {
            int       rowCnt, i;
            DataTable bookTable;
            DataRow   row;
            string    s1;

            DataTableCollection tablesCol = bookdSet.Tables;

            if (tablesCol.Contains("book") && tablesCol.CanRemove(tablesCol["book"]))
            {
                tablesCol.Remove("book");
            }


            booktv.BeginUpdate();
            booktv.Nodes.Clear();
            booktv.EndUpdate();

            sqlComm.CommandText = "SELECT book.ID, book.书名, book.文种号, book.图书分类号, book.种次号,borrow.副本, borrow.借出时间,borrow.归还时间,borrow.续借次数 ,borrow.电话, borrow.Ecode AS ISO编号, borrow.中文姓名 FROM book INNER JOIN borrow ON book.文种号 = borrow.文种号 AND book.种次号 = borrow.种次号 AND book.图书分类号 = borrow.图书分类号 WHERE (borrow.实际归还时间 IS NULL) AND (borrow.归还时间 < '" + System.DateTime.Now.ToString() + "') ORDER BY borrow.借出时间";

            sqlDataAdap.SelectCommand = sqlComm;
            sqlDataAdap.Fill(bookdSet, "book");

            bookDG.CaptionText = "查询所有未还图书";

            dv.Table = bookdSet.Tables["book"];

            dv.Table.Columns.Add("姓名");
            dv.Table.Columns.Add("部门");


            for (rowCnt = 0; rowCnt < dv.Table.Rows.Count; rowCnt++)
            {
                row = dv.Table.Rows[rowCnt];

                s1 = row["ISO编号"].ToString().Trim();

                if (s1 != "0")
                {
                    //sqlhrComm.CommandText="SELECT employees.ecode, employees.ecname, codeorgs.cdptname FROM employees INNER JOIN codeorgs ON employees.dept = codeorgs.dptno WHERE (employees.ecode = '"+s1+"')";

                    //sqlhrConn.Open();
                    //sqldr=sqlhrComm.ExecuteReader();

                    //sqldr.Read();

                    //if(sqldr.HasRows)
                    //{

                    //    row["姓名"]=sqldr.GetValue(1).ToString();
                    //    row["部门"]=sqldr.GetValue(2).ToString();
                    //}

                    //sqlhrConn.Close();
                    //sqldr.Close();

                    OracleComm.CommandText = "select v_sys_psn.psncode, v_sys_psn.psnname, v_sys_dept.first_deptname, v_sys_dept.second_deptname, v_sys_dept.third_deptname, v_sys_psn.mobile, v_sys_psn.officephone, v_sys_corp.UNITNAME from v_sys_psn LEFT OUTER JOIN V_SYS_DEPT ON v_sys_psn.pk_deptdoc = v_sys_dept.pk_fourtdept  LEFT OUTER JOIN v_sys_corp ON v_sys_psn.PK_CORP=v_sys_corp.PK_CORP where v_sys_psn.psncode=N'" + s1.PadLeft(5, '0') + "' ";//写好想执行的Sql语句
                    OracleConn.Open();
                    odr = OracleComm.ExecuteReader();

                    if (odr.HasRows)
                    {
                        odr.Read();
                        row["姓名"] = odr.GetValue(1).ToString();
                        row["部门"] = odr.GetValue(7).ToString() + "-" + odr.GetValue(2).ToString() + "-" + odr.GetValue(3).ToString() + "-" + odr.GetValue(4).ToString();
                    }
                    odr.Close();
                    OracleConn.Close();
                }
            }
            this.bookDG.DataSource = dv;
        }