Пример #1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <CustomerService.Model.Operator> DataTableToList(DataTable dt)
        {
            List <CustomerService.Model.Operator> modelList = new List <CustomerService.Model.Operator>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                CustomerService.Model.Operator model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new CustomerService.Model.Operator();
                    if (dt.Rows[n]["GUID"] != null && dt.Rows[n]["GUID"].ToString() != "")
                    {
                        model.GUID = new Guid(dt.Rows[n]["GUID"].ToString());
                    }
                    if (dt.Rows[n]["user"] != null && dt.Rows[n]["user"].ToString() != "")
                    {
                        model.user = new Guid(dt.Rows[n]["user"].ToString());
                    }
                    if (dt.Rows[n]["content"] != null && dt.Rows[n]["content"].ToString() != "")
                    {
                        model.content = dt.Rows[n]["content"].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
		/// <summary>
		/// 获得数据列表
		/// </summary>
		public List<CustomerService.Model.Operator> DataTableToList(DataTable dt)
		{
			List<CustomerService.Model.Operator> modelList = new List<CustomerService.Model.Operator>();
			int rowsCount = dt.Rows.Count;
			if (rowsCount > 0)
			{
				CustomerService.Model.Operator model;
				for (int n = 0; n < rowsCount; n++)
				{
					model = new CustomerService.Model.Operator();
					if(dt.Rows[n]["GUID"]!=null && dt.Rows[n]["GUID"].ToString()!="")
					{
						model.GUID=new Guid(dt.Rows[n]["GUID"].ToString());
					}
					if(dt.Rows[n]["user"]!=null && dt.Rows[n]["user"].ToString()!="")
					{
						model.user=new Guid(dt.Rows[n]["user"].ToString());
					}
					if(dt.Rows[n]["content"]!=null && dt.Rows[n]["content"].ToString()!="")
					{
					model.content=dt.Rows[n]["content"].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.Operator model)
 {
     return(dal.Update(model));
 }
Пример #4
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(CustomerService.Model.Operator model)
 {
     return(dal.Add(model));
 }