private void BindData()
        {
            #region 组装查询条件
            string whereStr  = " question_id = " + qid;
            string _keywords = keywords.Replace("'", "");

            if (!string.IsNullOrEmpty(_keywords))
            {
                if (Utils.IsSafeSqlString(_keywords))
                {
                    whereStr += " and (title like  '%" + _keywords + "%')";
                }
                else
                {
                    JscriptMsg("搜索关键词中包含危险字符,检索终止!", Utils.CombUrlTxt("question_options.aspx", "keywords={0}&qid={1}", "", this.qid + ""));
                    return;
                }
            }
            #endregion

            this.page        = RequestHelper.GetQueryInt("page", 1);
            txtKeywords.Text = this.keywords;
            BLL.common_answers bll = new BLL.common_answers();
            this.rptList.DataSource = bll.GetListByPage("*", "View_Answers", whereStr, "options", this.page, this.pageSize);
            this.rptList.DataBind();

            this.totalCount = bll.GetRecordCount(whereStr);
            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("question_options.aspx", "keywords={0}&page={1}&qid={2}", this.keywords, "__id__", this.qid + "");
            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
        //批量删除
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("_common_answers", EnumCollection.ActionEnum.Delete.ToString()); //检查权限
            int sucCount   = 0;
            int errorCount = 0;

            BLL.common_answers bll = new BLL.common_answers();
            for (int i = 0; i < rptList.Items.Count; i++)
            {
                int      id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
                CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
                if (cb.Checked)
                {
                    if (bll.Delete(id))
                    {
                        sucCount += 1;
                    }
                    else
                    {
                        errorCount += 1;
                    }
                }
            }
            AddAdminLog(EnumCollection.ActionEnum.Delete.ToString(), "删除选项信息" + sucCount + "条,失败" + errorCount + "条"); //记录日志
            JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("question_options.aspx", "keywords={0}&qid={1}", this.keywords, this.qid + ""));
        }
        //保存
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("_ybd_common_answers", EnumCollection.ActionEnum.Add.ToString()); //检查权限

            #region
            string strError = string.Empty;
            if (txtquestion_id.Text.Trim() == "" || txtquestion_id.Text.Trim().Length > 4)
            {
                strError += "题目ID为空或超出长度![br]";
            }
            if (txtoptions.Text.Trim() == "" || txtoptions.Text.Trim().Length > 50)
            {
                strError += "选项为空或超出长度![br]";
            }
            if (txtcontents.Text.Trim() == "" || txtcontents.Text.Trim().Length > 4000)
            {
                strError += "选项内容为空或超出长度![br]";
            }
            if (txtscore.Text.Trim() == "" || txtscore.Text.Trim().Length > 4)
            {
                strError += "分值为空或超出长度![br]";
            }
            if (txtadd_time.Text.Trim() == "" || txtadd_time.Text.Trim().Length > 8)
            {
                strError += "添加时间为空或超出长度![br]";
            }

            if (strError != string.Empty)
            {
                JscriptMsg(strError, "", "Error");
                return;
            }
            #endregion

            Model.common_answers model = new Model.common_answers();
            BLL.common_answers   bll   = new BLL.common_answers();

            model.question_id = Convert.ToInt32(txtquestion_id.Text);
            model.options     = Convert.ToString(txtoptions.Text);
            model.contents    = Convert.ToString(txtcontents.Text);
            model.score       = Convert.ToInt32(txtscore.Text);
            model.add_time    = Convert.ToDateTime(txtadd_time.Text);

            int id = bll.Add(model);
            if (id > 0)
            {
                AddAdminLog(EnumCollection.ActionEnum.Add.ToString(), "添加选项信息信息,主键:" + id); //记录日志
                JscriptMsg("添加选项信息信息成功!", "Manage.aspx", "");
            }
            else
            {
                JscriptMsg("保存过程中发生错误!", "");
            }
        }
Exemple #4
0
        private void ShowInfo()
        {
            BLL.common_answers   bll   = new BLL.common_answers();
            Model.common_answers model = bll.GetModel(this.id);
            if (model == null)
            {
                JscriptMsg("信息不存在或已被删除!", "back");
                return;
            }

            txtoptions.Text  = model.options + "";
            txtcontents.Text = model.contents + "";
            txtscore.Text    = model.score + "";
        }
Exemple #5
0
        private void getQuestionOptions()
        {
            int id = RequestHelper.GetFormInt("id");

            Model.common_questions question = new BLL.common_questions().GetModel(id);
            if (question == null)
            {
                writeMsgError("没有此题目");
                return;
            }

            DataTable dt = new BLL.common_answers().GetList(" question_id = " + id + " order by options asc ");

            writeMsgSuccess("", dt);
        }
Exemple #6
0
        private bool DoEdit()
        {
            bool result = false;

            BLL.common_answers   bll   = new BLL.common_answers();
            Model.common_answers model = bll.GetModel(this.id);

            model.options  = Convert.ToString(txtoptions.Text.Trim());
            model.contents = Convert.ToString(txtcontents.Text.Trim());
            model.score    = Convert.ToInt32(txtscore.Text.Trim());

            if (bll.Update(model))
            {
                AddAdminLog(EnumCollection.ActionEnum.Modify.ToString(), "修改选项信息,主键:" + id); //记录日志
                result = true;
            }
            return(result);
        }
        protected string GetOptions(string ids)
        {
            BLL.common_answers   bll   = new BLL.common_answers();
            Model.common_answers model = null;
            string[]             arr   = ids.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

            string options = string.Empty;

            foreach (string id in arr)
            {
                model = bll.GetModel(Convert.ToInt32(id));
                if (model != null)
                {
                    options += model.options + ",";
                }
            }

            options = Utils.DelLastComma(options);

            return(options);
        }
Exemple #8
0
        //保存
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("_ybd_common_answers", EnumCollection.ActionEnum.Modify.ToString()); //检查权限
            BLL.common_answers   bll   = new BLL.common_answers();
            Model.common_answers model = bll.GetModel(this.id);

            model.question_id = Convert.ToInt32(txtquestion_id.Text);
            model.options     = Convert.ToString(txtoptions.Text);
            model.contents    = Convert.ToString(txtcontents.Text);
            model.score       = Convert.ToInt32(txtscore.Text);
            model.add_time    = Convert.ToDateTime(txtadd_time.Text);

            if (bll.Update(model))
            {
                AddAdminLog(EnumCollection.ActionEnum.Modify.ToString(), "修改选项信息信息,主键:" + id); //记录日志
                JscriptMsg("修改选项信息信息成功!", "Manage.aspx");
            }
            else
            {
                JscriptMsg("保存过程中发生错误!", "");
            }
        }
Exemple #9
0
        private bool DoAdd()
        {
            bool result = false;

            BLL.common_answers   bll   = new BLL.common_answers();
            Model.common_answers model = new Model.common_answers();

            model.question_id = this.qid;
            model.options     = Convert.ToString(txtoptions.Text.Trim());
            model.contents    = Convert.ToString(txtcontents.Text.Trim());
            model.score       = Convert.ToInt32(txtscore.Text.Trim());
            model.add_time    = System.DateTime.Now;

            int id = bll.Add(model);

            if (id > 0)
            {
                AddAdminLog(EnumCollection.ActionEnum.Add.ToString(), "添加选项信息,主键:" + id); //记录日志
                result = true;
            }
            return(result);
        }
Exemple #10
0
        private void saveQuestionOptions()
        {
            int    id       = RequestHelper.GetFormInt("id");
            int    group    = RequestHelper.GetFormInt("group", 0);
            int    type     = RequestHelper.GetFormInt("type", 0);
            int    chapter  = RequestHelper.GetFormInt("chapter", 0);
            string title    = RequestHelper.GetFormString("title");
            int    score    = RequestHelper.GetFormInt("score", 0);
            string answers  = RequestHelper.GetFormString("answers");
            string analysis = RequestHelper.GetFormString("analysis");
            string options  = RequestHelper.GetFormString("options");

            Appoa.Web.UI.ManagePage mngPage = new Web.UI.ManagePage();
            BLL.common_questions    bll     = new BLL.common_questions();
            Model.common_questions  model   = bll.GetModel(id);

            if (model != null)
            {
                #region 修改题目信息
                model.group_id = group;
                model.type     = type;
                model.data_id  = chapter;
                model.number   = 0;
                model.title    = title;
                model.answer   = (model.type == (int)EnumCollection.questions_type.单选题 || model.type == (int)EnumCollection.questions_type.多选题 ||
                                  model.type == (int)EnumCollection.questions_type.判断题) ? answers.Trim().ToUpper() : answers.Trim();
                model.score    = score;
                model.analysis = HttpUtility.UrlDecode(analysis, System.Text.Encoding.UTF8);

                if (bll.Update(model))
                {
                    try
                    {
                        #region  择题设置选项
                        if (model.type == (int)EnumCollection.questions_type.单选题 || model.type == (int)EnumCollection.questions_type.多选题 || model.type == (int)EnumCollection.questions_type.判断题)
                        {
                            JArray               optionArr = JsonConvert.DeserializeObject <JArray>(options);
                            BLL.common_answers   anBll     = new BLL.common_answers();
                            Model.common_answers anModel   = null;

                            List <int> ids = new List <int>();
                            foreach (JObject obj in optionArr)
                            {
                                ids.Add(Convert.ToInt32(obj["options_id"].ToString()));
                            }

                            DataTable dt = anBll.GetList(" question_id = " + model.id);
                            foreach (DataRow item in dt.Rows)
                            {
                                int afid = Convert.ToInt32(item["id"]);
                                if (afid > 0)
                                {
                                    if (!ids.Contains(afid))
                                    {
                                        anBll.Delete(afid);
                                    }
                                }
                            }

                            foreach (JObject item in optionArr)
                            {
                                int options_id = Convert.ToInt32(item["options_id"]);
                                anModel = anBll.GetModel(options_id);
                                if (anModel != null)
                                {
                                    #region 修改选项
                                    anModel.question_id = model.id;
                                    anModel.options     = item["options"].ToString();
                                    anModel.contents    = item["options_contents"].ToString();
                                    anModel.score       = Convert.ToInt32(item["options_score"].ToString());
                                    if (anBll.Update(anModel))
                                    {
                                        mngPage.AddAdminLog(EnumCollection.ActionEnum.Modify.ToString(), "修改选项信息,主键:" + options_id); //记录日志
                                    }
                                    #endregion
                                }
                                else
                                {
                                    #region 添加选项
                                    anModel             = new Model.common_answers();
                                    anModel.question_id = model.id;
                                    anModel.options     = item["options"].ToString();
                                    anModel.contents    = item["options_contents"].ToString();
                                    anModel.score       = Convert.ToInt32(item["options_score"].ToString());
                                    anModel.add_time    = System.DateTime.Now;

                                    int anid = anBll.Add(anModel);
                                    if (anid > 0)
                                    {
                                        mngPage.AddAdminLog(EnumCollection.ActionEnum.Add.ToString(), "添加选项信息,主键:" + anid); //记录日志
                                    }
                                    #endregion
                                }
                            }
                        }
                        #endregion
                    }
                    catch (Exception e)
                    {
                        writeMsgError("系统错误:" + e.Message);
                    }

                    mngPage.AddAdminLog(EnumCollection.ActionEnum.Modify.ToString(), "修改试题信息,主键:" + model.id); //记录日志

                    writeMsgSuccess("修改题目信息成功");
                }
                else
                {
                    writeMsgError("修改题目信息失败");
                }
                #endregion
            }
            else
            {
                #region 添加题目信息
                model          = new Model.common_questions();
                model.group_id = group;
                model.type     = type;
                model.data_id  = chapter;
                model.number   = 0;
                model.title    = title;
                model.answer   = (model.type == (int)EnumCollection.questions_type.单选题 || model.type == (int)EnumCollection.questions_type.多选题 ||
                                  model.type == (int)EnumCollection.questions_type.判断题) ? answers.Trim().ToUpper() : answers.Trim();
                model.score    = score;
                model.analysis = HttpUtility.UrlDecode(analysis, System.Text.Encoding.UTF8);
                model.add_time = System.DateTime.Now;

                int qid = bll.Add(model);
                if (qid > 0)
                {
                    try
                    {
                        #region  择题设置选项
                        if (model.type == (int)EnumCollection.questions_type.单选题 || model.type == (int)EnumCollection.questions_type.多选题 || model.type == (int)EnumCollection.questions_type.判断题)
                        {
                            JArray               optionArr = JsonConvert.DeserializeObject <JArray>(options);
                            BLL.common_answers   anBll     = new BLL.common_answers();
                            Model.common_answers anModel   = null;

                            foreach (JObject item in optionArr)
                            {
                                int options_id = Convert.ToInt32(item["options_id"]);
                                if (options_id > 0)
                                {
                                    #region 修改选项
                                    anModel = anBll.GetModel(options_id);
                                    if (anModel != null)
                                    {
                                        anModel.question_id = qid;
                                        anModel.options     = item["options"].ToString();
                                        anModel.contents    = item["options_contents"].ToString();
                                        anModel.score       = Convert.ToInt32(item["options_score"].ToString());
                                        if (anBll.Update(anModel))
                                        {
                                            mngPage.AddAdminLog(EnumCollection.ActionEnum.Modify.ToString(), "修改选项信息,主键:" + options_id); //记录日志
                                        }
                                    }
                                    #endregion
                                }
                                else
                                {
                                    #region 添加选项
                                    anModel             = new Model.common_answers();
                                    anModel.question_id = qid;
                                    anModel.options     = item["options"].ToString();
                                    anModel.contents    = item["options_contents"].ToString();
                                    anModel.score       = Convert.ToInt32(item["options_score"].ToString());
                                    anModel.add_time    = System.DateTime.Now;

                                    int anid = anBll.Add(anModel);
                                    if (anid > 0)
                                    {
                                        mngPage.AddAdminLog(EnumCollection.ActionEnum.Add.ToString(), "添加选项信息,主键:" + anid); //记录日志
                                    }
                                    #endregion
                                }
                            }
                        }
                        #endregion
                    }
                    catch (Exception e)
                    {
                        writeMsgError("系统错误:" + e.Message);
                    }

                    mngPage.AddAdminLog(EnumCollection.ActionEnum.Add.ToString(), "添加试题信息,主键:" + qid); //记录日志

                    writeMsgSuccess("添加题目信息成功");
                }
                else
                {
                    writeMsgError("添加题目信息失败");
                }
                #endregion
            }
        }
Exemple #11
0
        private void SumScore(int exa_id, int uid)
        {
            int truth_count = 0;
            int score       = 0;

            BLL.common_questions     qBll  = new BLL.common_questions();
            BLL.answer_record        arBll = new BLL.answer_record();
            BLL.common_answers       aBll  = new BLL.common_answers();
            Model.user_info          user  = new BLL.user_info().GetModel(uid);
            Model.common_examination exa   = new BLL.common_examination().GetModel(exa_id);
            if (exa != null)
            {
                DataTable dt = arBll.GetList(" exa_id = " + exa_id + " and user_id = " + uid);

                foreach (DataRow item in dt.Rows)
                {
                    #region 批改作业按老师选择对错为准
                    int is_truth = Convert.ToInt32(item["is_truth"]);

                    if (is_truth == 1)
                    {
                        truth_count++;
                        score += Convert.ToInt32(item["score"]);
                    }
                    #endregion

                    #region 批改作业按答题记录为准
                    //int q_id = Convert.ToInt32(item["q_id"]);
                    //string answer = item["answer"].ToString();

                    //Model.common_questions question = qBll.GetModel(q_id);
                    //if (!string.IsNullOrEmpty(answer))//没有答题
                    //{
                    //    if (question.type == (int)EnumCollection.questions_type.单选题 || question.type == (int)EnumCollection.questions_type.判断题)
                    //    {
                    //        Model.common_answers anModel = aBll.GetModel(Convert.ToInt32(answer));
                    //        if (anModel.options == question.answer)
                    //        {
                    //            truth_count++;
                    //            score += Convert.ToInt32(item["score"]);
                    //        }
                    //    }
                    //    if (question.type == (int)EnumCollection.questions_type.多选题)
                    //    {
                    //        string[] ids = answer.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                    //        string anids = string.Empty;
                    //        foreach (string id in ids)
                    //        {
                    //            Model.common_answers anModel = aBll.GetModel(Convert.ToInt32(id));
                    //            anids += anModel.options + ",";
                    //        }
                    //        if (question.answer == Utils.DelLastComma(anids))
                    //        {
                    //            truth_count++;
                    //            score += Convert.ToInt32(item["score"]);
                    //        }
                    //    }
                    //    if (question.type == (int)EnumCollection.questions_type.填空题 || question.type == (int)EnumCollection.questions_type.主观题)
                    //    {
                    //        if (answer.Contains(question.answer))
                    //        {
                    //            truth_count++;
                    //            score += Convert.ToInt32(item["score"]);
                    //        }
                    //    }
                    //}
                    #endregion
                }

                BLL.answer_result   bll   = new BLL.answer_result();
                Model.answer_result model = bll.GetModel(" group_id = " + (int)EnumCollection.examination_group.课堂作业 + " and exa_id = " + exa_id + " and user_id = " + uid);
                if (model != null)
                {
                    model.truth_num   = truth_count;
                    model.count       = exa.nums;
                    model.truth_ratio = Convert.ToDecimal((decimal)model.truth_num / (decimal)model.count) * 100;
                    model.score       = score;
                    model.status      = (int)EnumCollection.correcting_status.已批改;

                    bll.Update(model);
                }
                else
                {
                    model             = new Model.answer_result();
                    model.group_id    = (int)EnumCollection.examination_group.课堂作业;
                    model.exa_id      = exa_id;
                    model.exa_title   = exa.name;
                    model.user_id     = uid;
                    model.avatar      = user.avatar;
                    model.nick_name   = user.nick_name;
                    model.use_min     = 0;
                    model.use_sec     = 0;
                    model.truth_num   = truth_count;
                    model.count       = exa.nums;
                    model.truth_ratio = 0;
                    model.score       = score;
                    model.status      = (int)EnumCollection.correcting_status.未批改;
                    model.add_time    = System.DateTime.Now;

                    bll.Add(model);
                }
            }
        }
        private DataTable ExcelToDataTable(string filePath, bool isColumnName)
        {
            int chapter = RequestHelper.GetQueryInt("chapter");

            DataTable  dataTable     = null;
            DataTable  dtOption      = null;
            FileStream fs            = null;
            DataColumn column        = null;
            DataRow    dataRow       = null;
            IWorkbook  workbook      = null;
            ISheet     sheetQuestion = null;
            ISheet     sheetOption   = null;
            IRow       row           = null;
            ICell      cell          = null;
            int        startRow      = 0;

            BLL.common_questions qbll = new BLL.common_questions();
            BLL.common_answers   obll = new BLL.common_answers();
            int group = Convert.ToInt32(this.rbtnGroup.SelectedValue);

            try
            {
                using (fs = File.OpenRead(filePath))
                {
                    // 2007版本
                    if (filePath.IndexOf(".xlsx") > 0)
                    {
                        workbook = new XSSFWorkbook(fs);
                    }
                    // 2003版本
                    else if (filePath.IndexOf(".xls") > 0)
                    {
                        workbook = new HSSFWorkbook(fs);
                    }

                    Dictionary <string, int> dic = GetQuestionDic();
                    if (workbook != null)
                    {
                        #region 问题表
                        sheetQuestion = workbook.GetSheetAt(0);//读取第一个sheetQuestion,当然也可以循环读取每个sheetQuestion
                        dataTable     = new DataTable();
                        if (sheetQuestion != null)
                        {
                            int rowCount = sheetQuestion.LastRowNum;//总行数
                            if (rowCount > 0)
                            {
                                IRow firstRow  = sheetQuestion.GetRow(0); //第一行
                                int  cellCount = firstRow.LastCellNum;    //列数

                                //构建datatable的列
                                if (isColumnName)
                                {
                                    startRow = 1;//如果第一行是列名,则从第二行开始读取
                                    for (int i = firstRow.FirstCellNum; i < cellCount; ++i)
                                    {
                                        cell = firstRow.GetCell(i);
                                        if (cell != null)
                                        {
                                            if (cell.StringCellValue != null)
                                            {
                                                column = new DataColumn(cell.StringCellValue);
                                                dataTable.Columns.Add(column);
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    for (int i = firstRow.FirstCellNum; i < cellCount; ++i)
                                    {
                                        column = new DataColumn("column" + (i + 1));
                                        dataTable.Columns.Add(column);
                                    }
                                }

                                //填充行
                                for (int i = startRow; i <= rowCount; ++i)
                                {
                                    row = sheetQuestion.GetRow(i);
                                    if (row == null)
                                    {
                                        continue;
                                    }

                                    dataRow = dataTable.NewRow();
                                    for (int j = row.FirstCellNum; j < cellCount; ++j)
                                    {
                                        cell = row.GetCell(j);
                                        if (cell == null)
                                        {
                                            dataRow[j] = "";
                                        }
                                        else
                                        {
                                            //CellType(Unknown = -1,Numeric = 0,String = 1,Formula = 2,Blank = 3,Boolean = 4,Error = 5,)
                                            switch (cell.CellType)
                                            {
                                            case CellType.Blank:
                                                dataRow[j] = "";
                                                break;

                                            case CellType.Numeric:
                                                short format = cell.CellStyle.DataFormat;
                                                //对时间格式(2015.12.5、2015/12/5、2015-12-5等)的处理
                                                if (format == 14 || format == 31 || format == 57 || format == 58)
                                                {
                                                    dataRow[j] = cell.DateCellValue;
                                                }
                                                else
                                                {
                                                    dataRow[j] = cell.NumericCellValue;
                                                }
                                                break;

                                            case CellType.String:
                                                dataRow[j] = cell.StringCellValue;
                                                break;
                                            }
                                        }
                                    }
                                    dataTable.Rows.Add(dataRow);
                                }
                            }
                        }
                        #endregion

                        Model.common_questions question = null;

                        foreach (DataRow item in dataTable.Rows)
                        {
                            question = qbll.GetModel(" group_id = " + group + " and title = '" + item[0].ToString() + "' ");
                            if (question == null)
                            {
                                question          = new Model.common_questions();
                                question.group_id = group;
                                question.type     = dic[item[1].ToString()];
                                question.data_id  = chapter;
                                question.number   = 0;
                                question.title    = item[0].ToString();
                                question.answer   = item[2].ToString();
                                question.score    = Convert.ToDecimal(item[3]);
                                question.analysis = item[4].ToString();
                                question.add_time = System.DateTime.Now;

                                qbll.Add(question);
                            }
                            else
                            {
                                question.group_id = group;
                                question.type     = dic[item[1].ToString()];
                                question.data_id  = chapter;
                                question.number   = 0;
                                question.answer   = item[2].ToString();
                                question.score    = Convert.ToDecimal(item[3]);
                                question.analysis = item[4].ToString();

                                qbll.Update(question);
                            }
                        }

                        #region  项表
                        sheetOption = workbook.GetSheetAt(1);//读取第一个sheetOption,当然也可以循环读取每个sheetOption
                        dtOption    = new DataTable();
                        if (sheetOption != null)
                        {
                            int rowCount = sheetOption.LastRowNum;//总行数
                            if (rowCount > 0)
                            {
                                IRow firstRow  = sheetOption.GetRow(0); //第一行
                                int  cellCount = firstRow.LastCellNum;  //列数

                                //构建datatable的列
                                if (isColumnName)
                                {
                                    startRow = 1;//如果第一行是列名,则从第二行开始读取
                                    for (int i = firstRow.FirstCellNum; i < cellCount; ++i)
                                    {
                                        cell = firstRow.GetCell(i);
                                        if (cell != null)
                                        {
                                            if (cell.StringCellValue != null)
                                            {
                                                column = new DataColumn(cell.StringCellValue);
                                                dtOption.Columns.Add(column);
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    for (int i = firstRow.FirstCellNum; i < cellCount; ++i)
                                    {
                                        column = new DataColumn("column" + (i + 1));
                                        dtOption.Columns.Add(column);
                                    }
                                }

                                //填充行
                                for (int i = startRow; i <= rowCount; ++i)
                                {
                                    row = sheetOption.GetRow(i);
                                    if (row == null)
                                    {
                                        continue;
                                    }

                                    dataRow = dtOption.NewRow();
                                    for (int j = row.FirstCellNum; j < cellCount; ++j)
                                    {
                                        cell = row.GetCell(j);
                                        if (cell == null)
                                        {
                                            dataRow[j] = "";
                                        }
                                        else
                                        {
                                            //CellType(Unknown = -1,Numeric = 0,String = 1,Formula = 2,Blank = 3,Boolean = 4,Error = 5,)
                                            switch (cell.CellType)
                                            {
                                            case CellType.Blank:
                                                dataRow[j] = "";
                                                break;

                                            case CellType.Numeric:
                                                short format = cell.CellStyle.DataFormat;
                                                //对时间格式(2015.12.5、2015/12/5、2015-12-5等)的处理
                                                if (format == 14 || format == 31 || format == 57 || format == 58)
                                                {
                                                    dataRow[j] = cell.DateCellValue;
                                                }
                                                else
                                                {
                                                    dataRow[j] = cell.NumericCellValue;
                                                }
                                                break;

                                            case CellType.String:
                                                dataRow[j] = cell.StringCellValue;
                                                break;
                                            }
                                        }
                                    }
                                    dtOption.Rows.Add(dataRow);
                                }
                            }
                        }
                        #endregion

                        Model.common_questions qModle = null;
                        Model.common_answers   option = null;

                        foreach (DataRow item in dtOption.Rows)
                        {
                            qModle = qbll.GetModel(" group_id = " + group + " and title = '" + item[0].ToString() + "' ");
                            if (qModle != null)
                            {
                                option = obll.GetModel(" question_id = " + qModle.id + " and contents = '" + item[2].ToString() + "' ");
                                if (option == null)
                                {
                                    option             = new Model.common_answers();
                                    option.question_id = qModle.id;
                                    option.options     = item[1].ToString();
                                    option.contents    = item[2].ToString();
                                    option.score       = dtOption.Columns.Count > 3 ? Convert.ToInt32(item[3].ToString()) : 0;
                                    option.add_time    = System.DateTime.Now;

                                    obll.Add(option);
                                }
                                else
                                {
                                    option.options = item[1].ToString();
                                    option.score   = dtOption.Columns.Count > 3 ? Convert.ToInt32(item[3].ToString()) : 0;

                                    obll.Update(option);
                                }
                            }
                        }
                    }
                }
                return(dataTable);
            }
            catch (Exception)
            {
                if (fs != null)
                {
                    fs.Close();
                }
                return(null);
            }
        }