/// <summary>
        /// 获得Model
        /// </summary>
        /// <param name="whereStr"></param>
        /// <returns></returns>
        public Model.common_answers GetModel(string whereStr)
        {
            DataTable dt = dal.GetList(whereStr).Tables[0];

            Model.common_answers model = dt.Rows.Count > 0 ? DataRowToModel(dt.Rows[0]) : null;
            return(model);
        }
        /// <summary>
        /// 获得Model
        /// </summary>
        /// <param name="Top">大于0取前几行数据,否则取全部</param>
        /// <param name="whereStr">where条件</param>
        /// <param name="filedOrder">排序字段Order By + filedOrder (不可为空)</param>
        /// <returns></returns>
        public Model.common_answers GetModel(int Top, string whereStr, string filedOrder)
        {
            DataTable dt = dal.GetList(Top, whereStr, filedOrder).Tables[0];

            Model.common_answers model = dt.Rows.Count > 0 ? DataRowToModel(dt.Rows[0]) : null;
            return(model);
        }
        //保存
        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("保存过程中发生错误!", "");
            }
        }
Example #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 + "";
        }
Example #5
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);
        }
Example #6
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Model.common_answers model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append(@"Insert Into ybd_common_answers(
                question_id            
                            ,options            
                            ,contents            
                            ,score            
                            ,add_time            
             ) Values (
                @question_id               
                            ,@options               
                            ,@contents               
                            ,@score               
                            ,@add_time               
             );
            SELECT @@IDENTITY;");

            SqlParameter[] parameters =
            {
                new SqlParameter("@question_id", SqlDbType.Int,                                4)
                ,                                new SqlParameter("@options",  SqlDbType.NVarChar, 50)
                ,                                new SqlParameter("@contents", SqlDbType.NVarChar, 4000)
                ,                                new SqlParameter("@score",    SqlDbType.Int, 4)
                ,                                new SqlParameter("@add_time", SqlDbType.DateTime, 8)
            };
            parameters[0].Value = model.question_id;
            parameters[1].Value = model.options;
            parameters[2].Value = model.contents;
            parameters[3].Value = model.score;
            parameters[4].Value = model.add_time;
            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
        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);
        }
Example #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("保存过程中发生错误!", "");
            }
        }
Example #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);
        }
Example #10
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Model.common_answers model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append(@"UPDATE ybd_common_answers SET 
                question_id = @question_id
                ,options = @options
                ,contents = @contents
                ,score = @score
                ,add_time = @add_time
            WHERE id = @id");

            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int,                       4)
                ,                       new SqlParameter("@question_id", SqlDbType.Int, 4)
                ,                       new SqlParameter("@options",     SqlDbType.NVarChar, 50)
                ,                       new SqlParameter("@contents",    SqlDbType.NVarChar, 4000)
                ,                       new SqlParameter("@score",       SqlDbType.Int, 4)
                ,                       new SqlParameter("@add_time",    SqlDbType.DateTime, 8)
            };
            parameters[0].Value = model.id;
            parameters[1].Value = model.question_id;
            parameters[2].Value = model.options;
            parameters[3].Value = model.contents;
            parameters[4].Value = model.score;
            parameters[5].Value = model.add_time;
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Model.common_answers DataRowToModel(DataRow row)
 {
     Model.common_answers model = new Model.common_answers();
     if (row != null)
     {
         if (row["id"] != null) //&& row["id"].ToString() != ""
         {
             model.id = Convert.ToInt32(row["id"]);
         }
         if (row["question_id"] != null) //&& row["question_id"].ToString() != ""
         {
             model.question_id = Convert.ToInt32(row["question_id"]);
         }
         if (row["options"] != null) //&& row["options"].ToString() != ""
         {
             model.options = Convert.ToString(row["options"]);
         }
         if (row["contents"] != null) //&& row["contents"].ToString() != ""
         {
             model.contents = Convert.ToString(row["contents"]);
         }
         if (row["score"] != null) //&& row["score"].ToString() != ""
         {
             model.score = Convert.ToInt32(row["score"]);
         }
         if (row["add_time"] != null && row["add_time"].ToString() != "")
         {
             model.add_time = Convert.ToDateTime(row["add_time"]);
         }
         return(model);
     }
     else
     {
         return(null);
     }
 }
Example #12
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
            }
        }
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Model.common_answers model)
 {
     return(dal.Update(model));
 }
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(Model.common_answers model)
 {
     return(dal.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);
            }
        }