コード例 #1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <MobileSoft.Model.HSPR.Tb_HSPR_CommunityInfo> DataTableToList(DataTable dt)
        {
            List <MobileSoft.Model.HSPR.Tb_HSPR_CommunityInfo> modelList = new List <MobileSoft.Model.HSPR.Tb_HSPR_CommunityInfo>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                MobileSoft.Model.HSPR.Tb_HSPR_CommunityInfo model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new MobileSoft.Model.HSPR.Tb_HSPR_CommunityInfo();
                    //model.InfoID=dt.Rows[n]["InfoID"].ToString();
                    if (dt.Rows[n]["CommID"].ToString() != "")
                    {
                        model.CommID = int.Parse(dt.Rows[n]["CommID"].ToString());
                    }
                    model.Heading = dt.Rows[n]["Heading"].ToString();
                    if (dt.Rows[n]["IssueDate"].ToString() != "")
                    {
                        model.IssueDate = DateTime.Parse(dt.Rows[n]["IssueDate"].ToString());
                    }
                    if (dt.Rows[n]["ShowEndDate"].ToString() != "")
                    {
                        model.ShowEndDate = DateTime.Parse(dt.Rows[n]["ShowEndDate"].ToString());
                    }
                    model.InfoSource = dt.Rows[n]["InfoSource"].ToString();
                    model.InfoType   = dt.Rows[n]["InfoType"].ToString();
                    if (dt.Rows[n]["IsAudit"].ToString() != "")
                    {
                        model.IsAudit = int.Parse(dt.Rows[n]["IsAudit"].ToString());
                    }
                    model.InfoContent = dt.Rows[n]["InfoContent"].ToString();
                    model.ImageUrl    = dt.Rows[n]["ImageUrl"].ToString();
                    if (dt.Rows[n]["CommInfoSynchCode"].ToString() != "")
                    {
                        model.CommInfoSynchCode = new Guid(dt.Rows[n]["CommInfoSynchCode"].ToString());
                    }
                    if (dt.Rows[n]["SynchFlag"].ToString() != "")
                    {
                        model.SynchFlag = int.Parse(dt.Rows[n]["SynchFlag"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
コード例 #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(MobileSoft.Model.HSPR.Tb_HSPR_CommunityInfo model)
 {
     dal.Update(model);
 }
コード例 #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public void Add(MobileSoft.Model.HSPR.Tb_HSPR_CommunityInfo model)
 {
     dal.Add(model);
 }