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

            if (rowsCount > 0)
            {
                Maticsoft.Model.W_Material model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Maticsoft.Model.W_Material();
                    if (dt.Rows[n]["Id"].ToString() != "")
                    {
                        model.Id = int.Parse(dt.Rows[n]["Id"].ToString());
                    }
                    model.Name = dt.Rows[n]["Name"].ToString();
                    if (dt.Rows[n]["Begindate"].ToString() != "")
                    {
                        model.Begindate = DateTime.Parse(dt.Rows[n]["Begindate"].ToString());
                    }
                    if (dt.Rows[n]["Enddate"].ToString() != "")
                    {
                        model.Enddate = DateTime.Parse(dt.Rows[n]["Enddate"].ToString());
                    }
                    model.Number  = dt.Rows[n]["Number"].ToString();
                    model.Address = dt.Rows[n]["Address"].ToString();
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Esempio n. 2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(Maticsoft.Model.W_Material model)
 {
     dal.Update(model);
 }
Esempio n. 3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(Maticsoft.Model.W_Material model)
 {
     return(dal.Add(model));
 }
Esempio n. 4
0
		/// <summary>
		/// 获得数据列表
		/// </summary>
		public List<Maticsoft.Model.W_Material> DataTableToList(DataTable dt)
		{
			List<Maticsoft.Model.W_Material> modelList = new List<Maticsoft.Model.W_Material>();
			int rowsCount = dt.Rows.Count;
			if (rowsCount > 0)
			{
				Maticsoft.Model.W_Material model;
				for (int n = 0; n < rowsCount; n++)
				{
					model = new Maticsoft.Model.W_Material();
					if(dt.Rows[n]["Id"].ToString()!="")
					{
						model.Id=int.Parse(dt.Rows[n]["Id"].ToString());
					}
					model.Name=dt.Rows[n]["Name"].ToString();
					if(dt.Rows[n]["Begindate"].ToString()!="")
					{
						model.Begindate=DateTime.Parse(dt.Rows[n]["Begindate"].ToString());
					}
					if(dt.Rows[n]["Enddate"].ToString()!="")
					{
						model.Enddate=DateTime.Parse(dt.Rows[n]["Enddate"].ToString());
					}
                    model.Number = dt.Rows[n]["Number"].ToString();
                    model.Address = dt.Rows[n]["Address"].ToString();
					modelList.Add(model);
				}
			}
			return modelList;
		}