Exemple #1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <GSSModel.Notfiy> DataTableToList(DataTable dt)
        {
            List <GSSModel.Notfiy> modelList = new List <GSSModel.Notfiy>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                GSSModel.Notfiy model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new GSSModel.Notfiy();
                    if (dt.Rows[n]["F_ID"].ToString() != "")
                    {
                        model.F_ID = int.Parse(dt.Rows[n]["F_ID"].ToString());
                    }
                    model.F_Title = dt.Rows[n]["F_Title"].ToString();
                    model.F_Note  = dt.Rows[n]["F_Note"].ToString();
                    model.F_URL   = dt.Rows[n]["F_URL"].ToString();
                    if (dt.Rows[n]["F_DateTime"].ToString() != "")
                    {
                        model.F_DateTime = DateTime.Parse(dt.Rows[n]["F_DateTime"].ToString());
                    }
                    if (dt.Rows[n]["F_SeeTime"].ToString() != "")
                    {
                        model.F_SeeTime = DateTime.Parse(dt.Rows[n]["F_SeeTime"].ToString());
                    }
                    if (dt.Rows[n]["F_IsSeed"].ToString() != "")
                    {
                        if ((dt.Rows[n]["F_IsSeed"].ToString() == "1") || (dt.Rows[n]["F_IsSeed"].ToString().ToLower() == "true"))
                        {
                            model.F_IsSeed = true;
                        }
                        else
                        {
                            model.F_IsSeed = false;
                        }
                    }
                    if (dt.Rows[n]["F_UserID"].ToString() != "")
                    {
                        model.F_UserID = int.Parse(dt.Rows[n]["F_UserID"].ToString());
                    }
                    if (dt.Rows[n]["F_Type"].ToString() != "")
                    {
                        model.F_Type = int.Parse(dt.Rows[n]["F_Type"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Exemple #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(GSSModel.Notfiy model)
 {
     return(dal.Update(model));
 }
Exemple #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(GSSModel.Notfiy model)
 {
     return(dal.Add(model));
 }