Example #1
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(DigiPower.Onlinecol.Standard.Model.T_Question_MDL model)
 {
     return(dal.Add(model));
 }
Example #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(DigiPower.Onlinecol.Standard.Model.T_Question_MDL model)
 {
     dal.Update(model);
 }
Example #3
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <DigiPower.Onlinecol.Standard.Model.T_Question_MDL> DataTableToList(DataTable dt)
        {
            List <DigiPower.Onlinecol.Standard.Model.T_Question_MDL> modelList = new List <DigiPower.Onlinecol.Standard.Model.T_Question_MDL>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                DigiPower.Onlinecol.Standard.Model.T_Question_MDL model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new DigiPower.Onlinecol.Standard.Model.T_Question_MDL();
                    if (dt.Rows[n]["QuestionID"].ToString() != "")
                    {
                        model.QuestionID = int.Parse(dt.Rows[n]["QuestionID"].ToString());
                    }
                    if (dt.Rows[n]["SingleProjectID"].ToString() != "")
                    {
                        model.SingleProjectID = int.Parse(dt.Rows[n]["SingleProjectID"].ToString());
                    }

                    if (dt.Rows[n]["FileListID"].ToString() != "")
                    {
                        model.FileListID = int.Parse(dt.Rows[n]["FileListID"].ToString());
                    }
                    model.QuestionTypeCode = dt.Rows[n]["QuestionTypeCode"].ToString();
                    model.Title            = dt.Rows[n]["Title"].ToString();
                    model.Description      = dt.Rows[n]["Description"].ToString();
                    if (dt.Rows[n]["CreateUserID"].ToString() != "")
                    {
                        model.CreateUserID = int.Parse(dt.Rows[n]["CreateUserID"].ToString());
                    }
                    model.CreateUserName = dt.Rows[n]["CreateUserName"].ToString();
                    if (dt.Rows[n]["CreateDate"].ToString() != "")
                    {
                        model.CreateDate = DateTime.Parse(dt.Rows[n]["CreateDate"].ToString());
                    }
                    if (dt.Rows[n]["AnswerCount"].ToString() != "")
                    {
                        model.AnswerCount = int.Parse(dt.Rows[n]["AnswerCount"].ToString());
                    }
                    if (dt.Rows[n]["ClickCount"].ToString() != "")
                    {
                        model.ClickCount = int.Parse(dt.Rows[n]["ClickCount"].ToString());
                    }
                    model.AttachName = dt.Rows[n]["AttachName"].ToString();
                    model.AttachPath = dt.Rows[n]["AttachPath"].ToString();
                    if (dt.Rows[n]["ReadFlag"].ToString() != "")
                    {
                        if ((dt.Rows[n]["ReadFlag"].ToString() == "1") || (dt.Rows[n]["ReadFlag"].ToString().ToLower() == "true"))
                        {
                            model.ReadFlag = true;
                        }
                        else
                        {
                            model.ReadFlag = false;
                        }
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }