コード例 #1
0
        protected void ExcelInput1_OnInput(object sender, EventArgs e)
        {
            org = Business.Do <IOrganization>().OrganCurrent();
            if (couid_get > 0)
            {
                course = Business.Do <ICourse>().CourseSingle(couid_get);
            }
            //工作簿中的数据
            DataTable dt = ExcelInput1.SheetDataTable;

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                try
                {
                    //throw new Exception();
                    //将数据逐行导入数据库
                    _inputData(dt.Rows[i]);
                }
                catch
                {
                    //如果出错,将错误行返回给控件
                    ExcelInput1.AddError(dt.Rows[i]);
                }
            }
            Business.Do <IQuestions>().OnSave(null, EventArgs.Empty);
            Business.Do <IOutline>().OnSave(null, EventArgs.Empty);
        }
コード例 #2
0
        protected void ExcelInput1_OnInput(object sender, EventArgs e)
        {
            //xml配置文件
            XmlDocument xmldoc  = new XmlDocument();
            string      confing = WeiSha.Common.App.Get["ExcelInputConfig"].VirtualPath + ExcelInput1.Config;

            xmldoc.Load(WeiSha.Common.Server.MapPath(confing));
            XmlNodeList nodes = xmldoc.GetElementsByTagName("item");
            //工作簿中的数据
            DataTable dt = ExcelInput1.SheetDataTable;

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                try
                {
                    //将数据逐行导入数据库
                    _inputData(dt.Rows[i], nodes);
                }
                catch (Exception ex)
                {
                    //如果出错,将错误行返回给控件
                    ExcelInput1.AddError(dt.Rows[i]);
                }
            }
            Business.Do <IOutline>().OnSave(null, EventArgs.Empty);
        }
コード例 #3
0
        protected void ExcelInput1_OnInput(object sender, EventArgs e)
        {
            //工作簿中的数据
            DataTable dt = ExcelInput1.SheetDataTable;

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                try
                {
                    //throw new Exception();
                    //将数据逐行导入数据库
                    _inputData(dt.Rows[i]);
                }
                catch
                {
                    //如果出错,将错误行返回给控件
                    ExcelInput1.AddError(dt.Rows[i]);
                }
            }
        }
コード例 #4
0
        protected void ExcelInput1_OnInput(object sender, EventArgs e)
        {
            org = Business.Do <IOrganization>().OrganCurrent();
            //工作簿中的数据
            DataTable dt = ExcelInput1.SheetDataTable;

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                try
                {
                    //将数据逐行导入数据库
                    _inputData(dt.Rows[i]);
                }
                catch
                {
                    //如果出错,将错误行返回给控件
                    ExcelInput1.AddError(dt.Rows[i]);
                }
            }
        }