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

            if (rowsCount > 0)
            {
                university.Model.CCOM.Notice model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new university.Model.CCOM.Notice();
                    if (dt.Rows[n]["Notice_id"].ToString() != "")
                    {
                        model.Notice_id = long.Parse(dt.Rows[n]["Notice_id"].ToString());
                    }
                    model.Notice_title   = dt.Rows[n]["Notice_title"].ToString();
                    model.Notice_content = dt.Rows[n]["Notice_content"].ToString();
                    if (dt.Rows[n]["Notice_date"].ToString() != "")
                    {
                        model.Notice_date = DateTime.Parse(dt.Rows[n]["Notice_date"].ToString());
                    }
                    if (dt.Rows[n]["Notice_sender_id"].ToString() != "")
                    {
                        model.Notice_sender_id = long.Parse(dt.Rows[n]["Notice_sender_id"].ToString());
                    }
                    model.Notice_receiver_id = dt.Rows[n]["Notice_receiver_id"].ToString();
                    if (dt.Rows[n]["Notice_type"].ToString() != "")
                    {
                        if ((dt.Rows[n]["Notice_type"].ToString() == "1") || (dt.Rows[n]["Notice_type"].ToString().ToLower() == "true"))
                        {
                            model.Notice_type = true;
                        }
                        else
                        {
                            model.Notice_type = false;
                        }
                    }
                    model.Notice_URL = dt.Rows[n]["Notice_URL"].ToString();
                    if (dt.Rows[n]["Notice_type_id"].ToString() != "")
                    {
                        model.Notice_type_id = long.Parse(dt.Rows[n]["Notice_type_id"].ToString());
                    }
                    if (dt.Rows[n]["Notice_last_editor"].ToString() != "")
                    {
                        model.Notice_last_editor = long.Parse(dt.Rows[n]["Notice_last_editor"].ToString());
                    }
                    if (dt.Rows[n]["Notice_flag"].ToString() != "")
                    {
                        if ((dt.Rows[n]["Notice_flag"].ToString() == "1") || (dt.Rows[n]["Notice_flag"].ToString().ToLower() == "true"))
                        {
                            model.Notice_flag = true;
                        }
                        else
                        {
                            model.Notice_flag = false;
                        }
                    }


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