示例#1
0
        public string NextWord(int Eid, int Elevel)
        {
            string str = "";

            Model.English emodel = new Model.English();
            emodel = dal.GetNextModel(Eid, Elevel);
            if (emodel != null)
            {
                str = emodel.Eid + "|" + emodel.Eword + "|" + emodel.Emeaning;
            }
            return(str);
        }
示例#2
0
        /// <summary>
        /// 将DataSet导入到英文词典表English中
        /// </summary>
        /// <param name="upexcelpath"></param>
        public static string DataSettoEnglish()
        {
            DataSet ds  = ExcelEnToDataSet();
            string  msg = "";

            if (ds != null)
            {
                int      count        = ds.Tables[0].Rows.Count;
                int      columnscount = ds.Tables[0].Columns.Count;
                int      isright      = 0;
                string[] strColumn    = { "Eword", "Emeaning", "Elevel" };
                for (int k = 0; k < columnscount; k++)
                {
                    string strname = ds.Tables[0].Columns[k].ColumnName;
                    foreach (string str in strColumn)
                    {
                        if (strname == str)
                        {
                            isright++;
                        }
                    }
                }
                if (isright == strColumn.Length)
                {
                    if (count > 0)
                    {
                        LearnSite.Model.English emodel = new Model.English();
                        LearnSite.BLL.English   ebll   = new BLL.English();
                        int right = 0;
                        for (int i = 0; i < count; i++)
                        {
                            string Eword     = ds.Tables[0].Rows[i]["Eword"].ToString();//英语单词
                            string Emeaning  = ds.Tables[0].Rows[i]["Emeaning"].ToString();
                            string Elevelstr = ds.Tables[0].Rows[i]["Elevel"].ToString();
                            int    Elevel    = 9;
                            if (Elevelstr != "")
                            {
                                Elevel = Int32.Parse(Elevelstr);
                            }
                            if (Eword != "")
                            {
                                emodel.Eword    = Eword;
                                emodel.Emeaning = Emeaning.Replace("<br>", "<br />");
                                emodel.Elevel   = Elevel;
                                if (ebll.Add(emodel) > 0)
                                {
                                    right++;
                                }
                            }
                        }
                        msg = "Excel表格数据共" + count + "条,导入数据库成功共" + right + "条";
                    }
                    else
                    {
                        msg = "无数据!";
                    }
                }
                else
                {
                    msg = "Excel数据格式不正确,请导入原en.xls";
                }
            }
            else
            {
                msg = "网站UpExcel目录下无en.xls文件!";
            }
            return(msg);
        }