static void Main(string[] args)
        {
            // Choose the number of points and generate the abscissas and weights
            int n = 32;

            // Tolerance and max number of iterations for the bisection algorithm
            double Tol     = 1e-10;
            int    MaxIter = 5000;

            // Starting and ending values for intervals containing roots, and # points
            double a  = -1e-2;
            double b  = 120;
            int    nI = 1500;

            // Gauss Laguerre abscissas and weights
            XW xw = GaussLaguerre(n, a, b, nI, Tol, MaxIter);

            double[] x = xw.abscissas;
            double[] w = xw.weights;

            // Output the results
            Console.WriteLine("{0:F0}-point Gauss Laguerre", x.Length);
            Console.WriteLine();
            Console.WriteLine(" Number  Abscissa   Weight");
            Console.WriteLine("------------------------------");
            for (int i = 0; i <= n - 1; i++)
            {
                Console.WriteLine("{0,5:F0} {1,10:F4} {2,10:F4}", i + 1, x[i], w[i]);
            }
            Console.WriteLine("------------------------------");
        }
Exemple #2
0
        /// <summary>
        /// 更新一条记录
        /// </summary>
        /// <param name="xw">要更新的学位论文信息</param>
        /// <returns>更新结果,true更新成功;false更新成功</returns>
        public Boolean updateXW(XW xw)
        {
            //打开连接
            this.openOleDbConnection();

            //sql语句
            OleDbCommand sqlcmd = new OleDbCommand(@"update xw set 分类编码=@分类编码,索引编码=@索引编码,分类体系=@分类体系,年份=@年份,文件名=@文件名,全文=@全文 where 中文题名=@中文题名 and 作者=@作者 and 导师=@导师", this.ObjConnection);

            sqlcmd.Parameters.Add(new OleDbParameter("分类编码", xw.Xw_flbm));
            sqlcmd.Parameters.Add(new OleDbParameter("索引编码", xw.Xw_sybm));
            sqlcmd.Parameters.Add(new OleDbParameter("分类体系", xw.Xw_fltx));
            sqlcmd.Parameters.Add(new OleDbParameter("年份",xw.Xw_nf));
            sqlcmd.Parameters.Add(new OleDbParameter("文件名", xw.Xw_wjm));
            sqlcmd.Parameters.Add(new OleDbParameter("全文", xw.Xw_qw));
            sqlcmd.Parameters.Add(new OleDbParameter("中文题名", xw.Xw_zwtm));
            sqlcmd.Parameters.Add(new OleDbParameter("作者", xw.Xw_zz));
            sqlcmd.Parameters.Add(new OleDbParameter("导师", xw.Xw_ds));
            int back=sqlcmd.ExecuteNonQuery();
            if (back == 0)
            {
                return false;
            }
            //objConnection.Close();
            return true;
        }
Exemple #3
0
        /// <summary>
        /// 本地Access库去重
        /// </summary>
        /// <param name="xw"></param>
        public void removeDuplicate(XW xw)
        {
            //打开Access连接
            this.openOleDbConnection();

            //sql语句
            OleDbCommand sqlcmd = new OleDbCommand();
            sqlcmd.CommandText = @"select * from xw where 中文题名=@中文题名 and 作者=@作者 and 导师=@导师";
            sqlcmd.Connection = this.ObjConnection;
            sqlcmd.Parameters.Add(new OleDbParameter("中文题名", xw.Xw_zwtm));
            sqlcmd.Parameters.Add(new OleDbParameter("作者", xw.Xw_zz));
            sqlcmd.Parameters.Add(new OleDbParameter("导师", xw.Xw_ds));

            OleDbDataReader oda= sqlcmd.ExecuteReader();
            int back = 0;
            while(oda.Read())
            {
                back++;
            }
            oda.Close();
            sqlcmd.Parameters.Clear();

            if (back >= 2)
            {
                //sqlcmd = new OleDbCommand(@"delete from xw  where 中文题名='" + xw.Xw_zwtm + "' and 作者='" + xw.Xw_zz + "' and 导师='" + xw.Xw_ds + "'", this.ObjConnection);
                sqlcmd.CommandText = @"delete from xw  where 中文题名=@中文题名 and 作者=@作者 and 导师=@导师";
                sqlcmd.Parameters.Add(new OleDbParameter("中文题名", xw.Xw_zwtm));
                sqlcmd.Parameters.Add(new OleDbParameter("作者", xw.Xw_zz));
                sqlcmd.Parameters.Add(new OleDbParameter("导师", xw.Xw_ds));
                sqlcmd.ExecuteNonQuery();
                sqlcmd.Parameters.Clear();

                sqlcmd.CommandText = @"insert into xw(中文题名,英文题名,作者,导师,论文级别,学科专业名称,分类号,学位授予单位,论文提交日期,论文答辩日期,中文关键词,中文摘要,英文摘要,年份,英文关键词,原文件名,出版日期,页数,学位授予日期,分类编码,索引编码,文件名,分类体系,更新日期,全文) values(@中文题名,@英文题名,@作者,@导师,@论文级别,@学科专业名称,@分类号,@学位授予单位,@论文提交日期,@论文答辩日期,@中文关键词,@中文摘要,@英文摘要,@年份,@英文关键词,@原文件名,@出版日期,@页数,@学位授予日期,@分类编码,@索引编码,@文件名,@分类体系,@更新日期,@全文)";
                sqlcmd.Parameters.Add(new OleDbParameter("中文题名", xw.Xw_zwtm));
                sqlcmd.Parameters.Add(new OleDbParameter("英文题名", xw.Xw_ywtm));
                sqlcmd.Parameters.Add(new OleDbParameter("作者", xw.Xw_zz));
                sqlcmd.Parameters.Add(new OleDbParameter("导师", xw.Xw_ds));
                sqlcmd.Parameters.Add(new OleDbParameter("论文级别", xw.Xw_lwjb));
                sqlcmd.Parameters.Add(new OleDbParameter("学科专业名称", xw.Xw_xkzymc));
                sqlcmd.Parameters.Add(new OleDbParameter("分类号", xw.Xw_flh));
                sqlcmd.Parameters.Add(new OleDbParameter("学科授予单位", xw.Xw_xwsydw));
                sqlcmd.Parameters.Add(new OleDbParameter("论文提交日期", xw.Xw_lwtjrq));
                sqlcmd.Parameters.Add(new OleDbParameter("论文答辩日期", xw.Xw_lwdbrq));
                sqlcmd.Parameters.Add(new OleDbParameter("中文关键词", xw.Xw_zwgjc));
                sqlcmd.Parameters.Add(new OleDbParameter("中文摘要", xw.Xw_zwzy));
                sqlcmd.Parameters.Add(new OleDbParameter("英文摘要", xw.Xw_ywzy));
                sqlcmd.Parameters.Add(new OleDbParameter("年份", xw.Xw_nf));
                sqlcmd.Parameters.Add(new OleDbParameter("英文关键词", xw.Xw_ywgjc));
                sqlcmd.Parameters.Add(new OleDbParameter("原文件名", xw.Xw_ywjm));
                sqlcmd.Parameters.Add(new OleDbParameter("出版日期", xw.Xw_cbrq));
                sqlcmd.Parameters.Add(new OleDbParameter("页数", xw.Xw_ys));
                sqlcmd.Parameters.Add(new OleDbParameter("学位授予日期", xw.Xw_xwsyrq));
                sqlcmd.Parameters.Add(new OleDbParameter("分类编码", xw.Xw_flbm));
                sqlcmd.Parameters.Add(new OleDbParameter("索引编码", xw.Xw_sybm));
                sqlcmd.Parameters.Add(new OleDbParameter("文件名", xw.Xw_wjm));
                sqlcmd.Parameters.Add(new OleDbParameter("分类体系", xw.Xw_fltx));
                sqlcmd.Parameters.Add(new OleDbParameter("更新日期", xw.Xw_gxrq));
                sqlcmd.Parameters.Add(new OleDbParameter("全文", xw.Xw_qw));
                sqlcmd.ExecuteNonQuery();
                sqlcmd.Parameters.Clear();

            }
        }
Exemple #4
0
        /// <summary>
        /// 向主库中添加一条新记录
        /// </summary>
        /// <param name="xw">要添加的新记录</param>
        /// <returns>true添加成功;false添加失败</returns>
        public String addRecord(XW xw)
        {
            //建立连接
            SqlConnection conn = Connection.CONN;
            //打开连接
            Connection.openConnection();
            //新建命令
            SqlCommand cmd = new SqlCommand();
            cmd.Connection = conn;

            //cmd.CommandText = "insert into XW(xw_flbm,xw_sybm,xw_wjm,xw_zwtm,xw_ywtm,xw_zz,xw_ds,xw_lwjb,xw_xkzymc,xw_flh,xw_xwsydw,xw_lwtjrq,xw_lwdbrq,xw_zwgjc,xw_zwzy,xw_fltx,xw_ywzy,xw_nf,xw_ywgjc,xw_ywjm,xw_cbrq,xw_ys,xw_xwsyrq,xw_gxrq,xw_qw) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
            cmd.CommandText = "insert into XW(xw_flbm,xw_sybm,xw_wjm,xw_zwtm,xw_ywtm,xw_zz,xw_ds,xw_lwjb,xw_xkzymc,xw_flh,xw_xwsydw,xw_lwtjrq,xw_lwdbrq,xw_zwgjc,xw_zwzy,xw_fltx,xw_ywzy,xw_nf,xw_ywgjc,xw_ywjm,xw_cbrq,xw_ys,xw_xwsyrq,xw_gxrq,xw_qw) values(@xw_flbm,@xw_sybm,@xw_wjm,@xw_zwtm,@xw_ywtm,@xw_zz,@xw_ds,@xw_lwjb,@xw_xkzymc,@xw_flh,@xw_xwsydw,@xw_lwtjrq,@xw_lwdbrq,@xw_zwgjc,@xw_zwzy,@xw_fltx,@xw_ywzy,@xw_nf,@xw_ywgjc,@xw_ywjm,@xw_cbrq,@xw_ys,@xw_xwsyrq,@xw_gxrq,@xw_qw)";

            DateTime MIN=DateTime.Parse("1/1/1753");
            cmd.Parameters.Add(new SqlParameter("xw_flbm",xw.Xw_flbm));
            cmd.Parameters.Add(new SqlParameter("xw_sybm", xw.Xw_sybm));
            cmd.Parameters.Add(new SqlParameter("xw_wjm", xw.Xw_wjm));
            cmd.Parameters.Add(new SqlParameter("xw_zwtm", xw.Xw_zwtm));
            cmd.Parameters.Add(new SqlParameter("xw_ywtm", xw.Xw_ywtm));

            cmd.Parameters.Add(new SqlParameter("xw_zz", xw.Xw_zz));
            cmd.Parameters.Add(new SqlParameter("xw_ds", xw.Xw_ds));
            cmd.Parameters.Add(new SqlParameter("xw_lwjb", xw.Xw_lwjb));
            cmd.Parameters.Add(new SqlParameter("xw_xkzymc", xw.Xw_xkzymc));
            cmd.Parameters.Add(new SqlParameter("xw_flh", xw.Xw_flh));
            cmd.Parameters.Add(new SqlParameter("xw_xwsydw", xw.Xw_xwsydw));

            if (xw.Xw_lwtjrq.CompareTo(MIN) <= 0)
            {
                cmd.Parameters.Add(new SqlParameter("xw_lwtjrq", MIN));
            }
            else
            {
                cmd.Parameters.Add(new SqlParameter("xw_lwtjrq", xw.Xw_lwtjrq));
            }
            if (xw.Xw_lwdbrq.CompareTo(MIN) <= 0)
            {
                cmd.Parameters.Add(new SqlParameter("xw_lwdbrq", MIN));
            }
            else
            {
                cmd.Parameters.Add(new SqlParameter("xw_lwdbrq", xw.Xw_lwdbrq));
            }
            cmd.Parameters.Add(new SqlParameter("xw_zwgjc", xw.Xw_zwgjc));
            cmd.Parameters.Add(new SqlParameter("xw_zwzy", xw.Xw_zwzy));

            cmd.Parameters.Add(new SqlParameter("xw_fltx", xw.Xw_fltx));
            cmd.Parameters.Add(new SqlParameter("xw_ywzy", xw.Xw_ywzy));
            cmd.Parameters.Add(new SqlParameter("xw_nf", xw.Xw_nf));
            cmd.Parameters.Add(new SqlParameter("xw_ywgjc", xw.Xw_ywgjc));
            cmd.Parameters.Add(new SqlParameter("xw_ywjm", xw.Xw_ywjm));

            if (xw.Xw_cbrq.CompareTo(MIN) <= 0)
            {
                cmd.Parameters.Add(new SqlParameter("xw_cbrq", MIN));
            }
            else
            {
                cmd.Parameters.Add(new SqlParameter("xw_cbrq", xw.Xw_cbrq));
            }
            //cmd.Parameters.Add(new SqlParameter("xw_cbrq", xw.Xw_cbrq));
            cmd.Parameters.Add(new SqlParameter("xw_ys", xw.Xw_ys));
            if (xw.Xw_xwsyrq.CompareTo(MIN) <= 0)
            {
                cmd.Parameters.Add(new SqlParameter("xw_xwsyrq", MIN));
            }
            else
            {
                cmd.Parameters.Add(new SqlParameter("xw_xwsyrq", xw.Xw_xwsyrq));
            }
            //cmd.Parameters.Add(new SqlParameter("xw_xwsyrq", xw.Xw_xwsyrq));
            cmd.Parameters.Add(new SqlParameter("xw_gxrq", DateTime.Now));
            cmd.Parameters.Add(new SqlParameter("xw_qw", xw.Xw_qw));
            int back = 0;
            try
            {
                back = cmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            {

                return ex.Message;
            }
            if (back == 0)
                return "插入记录失败!!!";
            return null;
        }
Exemple #5
0
        /// <summary>
        /// 从Access数据库中读取XW表的信息
        /// </summary>
        /// <returns></returns>
        public List<XW> getXWList()
        {
            List<XW> result = new List<XW>();

            //打开连接
            this.openOleDbConnection();

            //sql语句
            OleDbCommand sqlcmd = new OleDbCommand(@"select * from xw", this.ObjConnection);

            //执行查询
            OleDbDataReader reader = sqlcmd.ExecuteReader();

            while (reader.Read())
            { //这个read调用很重要!不写的话运行时将提示找不到数据
                XW temp = new XW();
                temp.Xw_zwtm = reader["中文题名"].ToString();
                temp.Xw_ywtm = reader["英文题名"].ToString();
                temp.Xw_zz = reader["作者"].ToString();
                temp.Xw_ds = reader["导师"].ToString();
                temp.Xw_lwjb = reader["论文级别"].ToString();
                temp.Xw_xkzymc = reader["学科专业名称"].ToString();
                temp.Xw_flh = reader["分类号"].ToString();
                temp.Xw_xwsydw = reader["学位授予单位"].ToString();
                try
                {
                    temp.Xw_lwtjrq = DateTime.Parse(reader["论文提交日期"].ToString());
                }
                catch (Exception)
                {
                }
                try
                {
                    temp.Xw_lwdbrq = DateTime.Parse(reader["论文答辩日期"].ToString());
                }
                catch (Exception)
                {
                }
                temp.Xw_zwgjc = reader["中文关键词"].ToString();
                temp.Xw_zwzy = reader["中文摘要"].ToString();
                temp.Xw_ywzy = reader["英文摘要"].ToString();
                temp.Xw_nf = reader["年份"].ToString();
                temp.Xw_ywgjc = reader["英文关键词"].ToString();
                temp.Xw_ywjm = reader["原文件名"].ToString();
                try
                {
                    temp.Xw_cbrq = DateTime.Parse(reader["出版日期"].ToString());
                }
                catch (Exception)
                {
                }
                temp.Xw_ys = reader["页数"].ToString();
                try
                {
                    temp.Xw_xwsyrq = DateTime.Parse(reader["学位授予日期"].ToString());
                }
                catch (Exception)
                {
                }
                temp.Xw_flbm=reader["分类编码"].ToString();
                temp.Xw_sybm = reader["索引编码"].ToString();
                temp.Xw_wjm = reader["文件名"].ToString();
                temp.Xw_fltx=reader["分类体系"].ToString();
                try
                {
                    temp.Xw_gxrq = DateTime.Parse(reader["更新日期"].ToString());
                }
                catch (Exception)
                {
                }

                temp.Xw_qw=reader["全文"].ToString();
                result.Add(temp);
            }
            reader.Close();
            return result;
        }
Exemple #6
0
        /// <summary>
        /// 规整字段
        /// </summary>
        /// <param name="xw">要规整的记录</param>
        /// <returns>反馈规整信息,规整错误</returns>
        public String formatData(XW xw)
        {
            //反馈信息
            String result = null;
            //获取所有要存储的学位篇名
            if (String.Empty.Equals(xw.Xw_flh))
            {
                result = xw.Xw_zwtm + ":" + xw.Xw_zz + ":" + xw.Xw_ds + ":分类号为空";
            }
            else
            {
                //获取分类号,有分类号产生分类体系
                String fltx = "";
                Char begin = xw.Xw_flh[0];
                if (begin == 'T')
                {   //如果首字母为T,则需继续读取下一个字符
                    fltx = 'T'.ToString() + xw.Xw_flh[1].ToString();
                }
                else if (begin == 'o')
                {
                    //如果首字母为o,则分类体系为QQ
                    fltx = "QQ";
                }
                else
                {
                    //其他情况,则分类体系为首字母重复1次
                    fltx = begin.ToString() + begin.ToString();
                }

                if (!this.Hash.Contains(fltx))
                {
                    result = xw.Xw_zwtm + ":" + xw.Xw_zz + ":" + xw.Xw_ds + ":分类体系不存在";
                }

                //分类体系
                xw.Xw_fltx = fltx;
                //分类编码=XW+分类体系
                xw.Xw_flbm = "XW" + fltx;
                //年份=原文件名的前4位
                xw.Xw_nf = xw.Xw_ywjm.Substring(0, 4);
                //索引编码=分类编码+"-"+年份
                xw.Xw_sybm = xw.Xw_flbm + "-" + xw.Xw_nf;
            }
            return result;
        }
Exemple #7
0
        /// <summary>
        /// 主库查重
        /// </summary>
        /// <param name="xw"></param>
        /// <returns>true:说明主库中已存在该记录;false:说明主库中不存在该记录</returns>
        public Boolean findDuplicate(XW xw)
        {
            //建立连接
            SqlConnection conn = Connection.CONN;
            Connection.openConnection();
            //命令行
            SqlCommand cmd = new SqlCommand();
            cmd.Connection = conn;
            cmd.CommandText = "select * from XW where xw_zwtm=@xw_zwtm and xw_zz=@xw_zz and xw_ds=@xw_ds";
            cmd.Parameters.Add(new SqlParameter("xw_zwtm",xw.Xw_zwtm));
            cmd.Parameters.Add(new SqlParameter("xw_zz", xw.Xw_zz));
            cmd.Parameters.Add(new SqlParameter("xw_ds", xw.Xw_ds));

            SqlDataReader sda=cmd.ExecuteReader();
            if (sda.Read())
            {
                sda.Close();
                return true;
            }
            sda.Close();
            return false;
        }