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

            if (rowsCount > 0)
            {
                ForKids.DB.Model.DEVICEBASE model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new ForKids.DB.Model.DEVICEBASE();
                    if (dt.Rows[n]["ID"] != null && dt.Rows[n]["ID"].ToString() != "")
                    {
                        model.ID = int.Parse(dt.Rows[n]["ID"].ToString());
                    }
                    if (dt.Rows[n]["NAME"] != null && dt.Rows[n]["NAME"].ToString() != "")
                    {
                        model.NAME = dt.Rows[n]["NAME"].ToString();
                    }
                    if (dt.Rows[n]["FUNDING"] != null && dt.Rows[n]["FUNDING"].ToString() != "")
                    {
                        model.FUNDING = double.Parse(dt.Rows[n]["FUNDING"].ToString());
                    }
                    if (dt.Rows[n]["LOSSINFO"] != null && dt.Rows[n]["LOSSINFO"].ToString() != "")
                    {
                        model.LOSSINFO = dt.Rows[n]["LOSSINFO"].ToString();
                    }
                    if (dt.Rows[n]["PURCHASEPLAN"] != null && dt.Rows[n]["PURCHASEPLAN"].ToString() != "")
                    {
                        model.PURCHASEPLAN = dt.Rows[n]["PURCHASEPLAN"].ToString();
                    }
                    if (dt.Rows[n]["INVESTMENT"] != null && dt.Rows[n]["INVESTMENT"].ToString() != "")
                    {
                        model.INVESTMENT = double.Parse(dt.Rows[n]["INVESTMENT"].ToString());
                    }
                    if (dt.Rows[n]["PURCHASEDATE"] != null && dt.Rows[n]["PURCHASEDATE"].ToString() != "")
                    {
                        model.PURCHASEDATE = DateTime.Parse(dt.Rows[n]["PURCHASEDATE"].ToString());
                    }
                    if (dt.Rows[n]["DESCRIPTION"] != null && dt.Rows[n]["DESCRIPTION"].ToString() != "")
                    {
                        model.DESCRIPTION = dt.Rows[n]["DESCRIPTION"].ToString();
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Exemplo n.º 2
0
 /// <summary>
 /// 获得数据列表
 /// </summary>
 public List<ForKids.DB.Model.DEVICEBASE> DataTableToList(DataTable dt)
 {
     List<ForKids.DB.Model.DEVICEBASE> modelList = new List<ForKids.DB.Model.DEVICEBASE>();
     int rowsCount = dt.Rows.Count;
     if (rowsCount > 0)
     {
         ForKids.DB.Model.DEVICEBASE model;
         for (int n = 0; n < rowsCount; n++)
         {
             model = new ForKids.DB.Model.DEVICEBASE();
             if(dt.Rows[n]["ID"]!=null && dt.Rows[n]["ID"].ToString()!="")
             {
                 model.ID=int.Parse(dt.Rows[n]["ID"].ToString());
             }
             if(dt.Rows[n]["NAME"]!=null && dt.Rows[n]["NAME"].ToString()!="")
             {
             model.NAME=dt.Rows[n]["NAME"].ToString();
             }
             if(dt.Rows[n]["FUNDING"]!=null && dt.Rows[n]["FUNDING"].ToString()!="")
             {
             //model.FUNDING=dt.Rows[n]["FUNDING"].ToString();
             }
             if(dt.Rows[n]["LOSSINFO"]!=null && dt.Rows[n]["LOSSINFO"].ToString()!="")
             {
             model.LOSSINFO=dt.Rows[n]["LOSSINFO"].ToString();
             }
             if(dt.Rows[n]["PURCHASEPLAN"]!=null && dt.Rows[n]["PURCHASEPLAN"].ToString()!="")
             {
             model.PURCHASEPLAN=dt.Rows[n]["PURCHASEPLAN"].ToString();
             }
             if(dt.Rows[n]["INVESTMENT"]!=null && dt.Rows[n]["INVESTMENT"].ToString()!="")
             {
             //model.INVESTMENT=dt.Rows[n]["INVESTMENT"].ToString();
             }
             if(dt.Rows[n]["PURCHASEDATE"]!=null && dt.Rows[n]["PURCHASEDATE"].ToString()!="")
             {
                 model.PURCHASEDATE=DateTime.Parse(dt.Rows[n]["PURCHASEDATE"].ToString());
             }
             if(dt.Rows[n]["DESCRIPTION"]!=null && dt.Rows[n]["DESCRIPTION"].ToString()!="")
             {
             model.DESCRIPTION=dt.Rows[n]["DESCRIPTION"].ToString();
             }
             modelList.Add(model);
         }
     }
     return modelList;
 }
Exemplo n.º 3
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(ForKids.DB.Model.DEVICEBASE model)
 {
     return(dal.Update(model));
 }
Exemplo n.º 4
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(ForKids.DB.Model.DEVICEBASE model)
 {
     return(dal.Add(model));
 }