Exemplo n.º 1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <zlzw.Model.CareersTypeListModel> DataTableToList(DataTable dt)
        {
            List <zlzw.Model.CareersTypeListModel> modelList = new List <zlzw.Model.CareersTypeListModel>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                zlzw.Model.CareersTypeListModel model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new zlzw.Model.CareersTypeListModel();
                    if (dt.Rows[n]["CareersTypeID"] != null && dt.Rows[n]["CareersTypeID"].ToString() != "")
                    {
                        model.CareersTypeID = int.Parse(dt.Rows[n]["CareersTypeID"].ToString());
                    }
                    if (dt.Rows[n]["CareersTypeName"] != null && dt.Rows[n]["CareersTypeName"].ToString() != "")
                    {
                        model.CareersTypeName = dt.Rows[n]["CareersTypeName"].ToString();
                    }
                    if (dt.Rows[n]["IsEnable"] != null && dt.Rows[n]["IsEnable"].ToString() != "")
                    {
                        model.IsEnable = int.Parse(dt.Rows[n]["IsEnable"].ToString());
                    }
                    if (dt.Rows[n]["PublishDate"] != null && dt.Rows[n]["PublishDate"].ToString() != "")
                    {
                        model.PublishDate = DateTime.Parse(dt.Rows[n]["PublishDate"].ToString());
                    }
                    if (dt.Rows[n]["Other01"] != null && dt.Rows[n]["Other01"].ToString() != "")
                    {
                        model.Other01 = dt.Rows[n]["Other01"].ToString();
                    }
                    if (dt.Rows[n]["Other02"] != null && dt.Rows[n]["Other02"].ToString() != "")
                    {
                        model.Other02 = dt.Rows[n]["Other02"].ToString();
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Exemplo n.º 2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(zlzw.Model.CareersTypeListModel model)
 {
     return(dal.Update(model));
 }
Exemplo n.º 3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(zlzw.Model.CareersTypeListModel model)
 {
     return(dal.Add(model));
 }