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

            if (rowsCount > 0)
            {
                CustomerService.Model.Solution model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new CustomerService.Model.Solution();
                    if (dt.Rows[n]["GUID"] != null && dt.Rows[n]["GUID"].ToString() != "")
                    {
                        model.GUID = new Guid(dt.Rows[n]["GUID"].ToString());
                    }
                    if (dt.Rows[n]["sDescribe"] != null && dt.Rows[n]["sDescribe"].ToString() != "")
                    {
                        model.sDescribe = dt.Rows[n]["sDescribe"].ToString();
                    }
                    if (dt.Rows[n]["solution"] != null && dt.Rows[n]["solution"].ToString() != "")
                    {
                        model.solution = dt.Rows[n]["solution"].ToString();
                    }
                    if (dt.Rows[n]["createDate"] != null && dt.Rows[n]["createDate"].ToString() != "")
                    {
                        model.createDate = DateTime.Parse(dt.Rows[n]["createDate"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
コード例 #2
0
ファイル: Solution.cs プロジェクト: hubuUniversity/demo
		/// <summary>
		/// 获得数据列表
		/// </summary>
		public List<CustomerService.Model.Solution> DataTableToList(DataTable dt)
		{
			List<CustomerService.Model.Solution> modelList = new List<CustomerService.Model.Solution>();
			int rowsCount = dt.Rows.Count;
			if (rowsCount > 0)
			{
				CustomerService.Model.Solution model;
				for (int n = 0; n < rowsCount; n++)
				{
					model = new CustomerService.Model.Solution();
					if(dt.Rows[n]["GUID"]!=null && dt.Rows[n]["GUID"].ToString()!="")
					{
						model.GUID=new Guid(dt.Rows[n]["GUID"].ToString());
					}
					if(dt.Rows[n]["sDescribe"]!=null && dt.Rows[n]["sDescribe"].ToString()!="")
					{
					model.sDescribe=dt.Rows[n]["sDescribe"].ToString();
					}
					if(dt.Rows[n]["solution"]!=null && dt.Rows[n]["solution"].ToString()!="")
					{
					model.solution=dt.Rows[n]["solution"].ToString();
					}
					if(dt.Rows[n]["createDate"]!=null && dt.Rows[n]["createDate"].ToString()!="")
					{
						model.createDate=DateTime.Parse(dt.Rows[n]["createDate"].ToString());
					}
					modelList.Add(model);
				}
			}
			return modelList;
		}
コード例 #3
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(CustomerService.Model.Solution model)
 {
     return(dal.Update(model));
 }
コード例 #4
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(CustomerService.Model.Solution model)
 {
     return(dal.Add(model));
 }