示例#1
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(Hownet.Model.SampleMaterielList model)
 {
     return(dal.Add(model));
 }
示例#2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Hownet.Model.SampleMaterielList model)
 {
     return(dal.Update(model));
 }
示例#3
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <Hownet.Model.SampleMaterielList> DataTableToList(DataTable dt)
        {
            List <Hownet.Model.SampleMaterielList> modelList = new List <Hownet.Model.SampleMaterielList>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                Hownet.Model.SampleMaterielList model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Hownet.Model.SampleMaterielList();
                    if (dt.Rows[n]["ID"] != null && dt.Rows[n]["ID"].ToString() != "")
                    {
                        model.ID = int.Parse(dt.Rows[n]["ID"].ToString());
                    }
                    if (dt.Rows[n]["MainID"] != null && dt.Rows[n]["MainID"].ToString() != "")
                    {
                        model.MainID = int.Parse(dt.Rows[n]["MainID"].ToString());
                    }
                    if (dt.Rows[n]["MaterielID"] != null && dt.Rows[n]["MaterielID"].ToString() != "")
                    {
                        model.MaterielID = int.Parse(dt.Rows[n]["MaterielID"].ToString());
                    }
                    model.MaterielName = dt.Rows[n]["MaterielName"].ToString();
                    if (dt.Rows[n]["CaiPianID"] != null && dt.Rows[n]["CaiPianID"].ToString() != "")
                    {
                        model.CaiPianID = int.Parse(dt.Rows[n]["CaiPianID"].ToString());
                    }
                    model.CaiPianName = dt.Rows[n]["CaiPianName"].ToString();
                    if (dt.Rows[n]["SpecID"] != null && dt.Rows[n]["SpecID"].ToString() != "")
                    {
                        model.SpecID = int.Parse(dt.Rows[n]["SpecID"].ToString());
                    }
                    model.SpecName = dt.Rows[n]["SpecName"].ToString();
                    model.Weight   = dt.Rows[n]["Weight"].ToString();
                    if (dt.Rows[n]["CompanyID"] != null && dt.Rows[n]["CompanyID"].ToString() != "")
                    {
                        model.CompanyID = int.Parse(dt.Rows[n]["CompanyID"].ToString());
                    }
                    model.CompanyName = dt.Rows[n]["CompanyName"].ToString();
                    if (dt.Rows[n]["Color1ID"] != null && dt.Rows[n]["Color1ID"].ToString() != "")
                    {
                        model.Color1ID = int.Parse(dt.Rows[n]["Color1ID"].ToString());
                    }
                    model.Color1Name = dt.Rows[n]["Color1Name"].ToString();
                    if (dt.Rows[n]["Color2ID"] != null && dt.Rows[n]["Color2ID"].ToString() != "")
                    {
                        model.Color2ID = int.Parse(dt.Rows[n]["Color2ID"].ToString());
                    }
                    model.Color2Name = dt.Rows[n]["Color2Name"].ToString();
                    if (dt.Rows[n]["Color3ID"] != null && dt.Rows[n]["Color3ID"].ToString() != "")
                    {
                        model.Color3ID = int.Parse(dt.Rows[n]["Color3ID"].ToString());
                    }
                    model.Color3Name = dt.Rows[n]["Color3Name"].ToString();
                    if (dt.Rows[n]["Color4ID"] != null && dt.Rows[n]["Color4ID"].ToString() != "")
                    {
                        model.Color4ID = int.Parse(dt.Rows[n]["Color4ID"].ToString());
                    }
                    model.Color4Name = dt.Rows[n]["Color4Name"].ToString();
                    if (dt.Rows[n]["Color5ID"] != null && dt.Rows[n]["Color5ID"].ToString() != "")
                    {
                        model.Color5ID = int.Parse(dt.Rows[n]["Color5ID"].ToString());
                    }
                    model.Color5Name = dt.Rows[n]["Color5Name"].ToString();
                    if (dt.Rows[n]["Color6ID"] != null && dt.Rows[n]["Color6ID"].ToString() != "")
                    {
                        model.Color6ID = int.Parse(dt.Rows[n]["Color6ID"].ToString());
                    }
                    model.Color6Name = dt.Rows[n]["Color6Name"].ToString();
                    if (dt.Rows[n]["Color7ID"] != null && dt.Rows[n]["Color7ID"].ToString() != "")
                    {
                        model.Color7ID = int.Parse(dt.Rows[n]["Color7ID"].ToString());
                    }
                    model.Color7Name = dt.Rows[n]["Color7Name"].ToString();
                    if (dt.Rows[n]["Color8ID"] != null && dt.Rows[n]["Color8ID"].ToString() != "")
                    {
                        model.Color8ID = int.Parse(dt.Rows[n]["Color8ID"].ToString());
                    }
                    model.Color8Name = dt.Rows[n]["Color8Name"].ToString();
                    if (dt.Rows[n]["MeasureID"] != null && dt.Rows[n]["MeasureID"].ToString() != "")
                    {
                        model.MeasureID = int.Parse(dt.Rows[n]["MeasureID"].ToString());
                    }
                    model.Measurename = dt.Rows[n]["Measurename"].ToString();
                    modelList.Add(model);
                }
            }
            return(modelList);
        }