コード例 #1
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(university.Model.CCOM.Subject model)
 {
     return(dal.Add(model));
 }
コード例 #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(university.Model.CCOM.Subject model)
 {
     return(dal.Update(model));
 }
コード例 #3
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <university.Model.CCOM.Subject> DataTableToList(DataTable dt)
        {
            List <university.Model.CCOM.Subject> modelList = new List <university.Model.CCOM.Subject>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                university.Model.CCOM.Subject model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new university.Model.CCOM.Subject();
                    if (dt.Rows[n]["Subject_id"].ToString() != "")
                    {
                        model.Subject_id = int.Parse(dt.Rows[n]["Subject_id"].ToString());
                    }
                    model.Subject_title = dt.Rows[n]["Subject_title"].ToString();
                    if (dt.Rows[n]["Subject_type"].ToString() != "")
                    {
                        if ((dt.Rows[n]["Subject_type"].ToString() == "1") || (dt.Rows[n]["Subject_type"].ToString().ToLower() == "true"))
                        {
                            model.Subject_type = true;
                        }
                        else
                        {
                            model.Subject_type = false;
                        }
                    }
                    if (dt.Rows[n]["Value_type"].ToString() != "")
                    {
                        model.Value_type = int.Parse(dt.Rows[n]["Value_type"].ToString());
                    }
                    if (dt.Rows[n]["Value_count"].ToString() != "")
                    {
                        model.Value_count = int.Parse(dt.Rows[n]["Value_count"].ToString());
                    }
                    if (dt.Rows[n]["Manage_Agency_id"].ToString() != "")
                    {
                        model.Manage_Agency_id = int.Parse(dt.Rows[n]["Manage_Agency_id"].ToString());
                    }
                    if (dt.Rows[n]["Major_Agency_id"].ToString() != "")
                    {
                        model.Major_Agency_id = int.Parse(dt.Rows[n]["Major_Agency_id"].ToString());
                    }
                    if (dt.Rows[n]["Period_id"].ToString() != "")
                    {
                        model.Period_id = int.Parse(dt.Rows[n]["Period_id"].ToString());
                    }
                    if (dt.Rows[n]["Subject_weight"].ToString() != "")
                    {
                        model.Subject_weight = decimal.Parse(dt.Rows[n]["Subject_weight"].ToString());
                    }
                    if (dt.Rows[n]["Subject_level"].ToString() != "")
                    {
                        model.Subject_level = int.Parse(dt.Rows[n]["Subject_level"].ToString());
                    }
                    model.Subject_description = dt.Rows[n]["Subject_description"].ToString();
                    if (dt.Rows[n]["Fs_id"].ToString() != "")
                    {
                        model.Fs_id = int.Parse(dt.Rows[n]["Fs_id"].ToString());
                    }


                    modelList.Add(model);
                }
            }
            return(modelList);
        }