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

            if (rowsCount > 0)
            {
                Hownet.Model.Sample model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Hownet.Model.Sample();
                    if (dt.Rows[n]["ID"] != null && dt.Rows[n]["ID"].ToString() != "")
                    {
                        model.ID = int.Parse(dt.Rows[n]["ID"].ToString());
                    }
                    model.StrNum = dt.Rows[n]["StrNum"].ToString();
                    if (dt.Rows[n]["Num"] != null && dt.Rows[n]["Num"].ToString() != "")
                    {
                        model.Num = int.Parse(dt.Rows[n]["Num"].ToString());
                    }
                    model.Titlle      = dt.Rows[n]["Titlle"].ToString();
                    model.CompanyName = dt.Rows[n]["CompanyName"].ToString();
                    if (dt.Rows[n]["CompanyID"] != null && dt.Rows[n]["CompanyID"].ToString() != "")
                    {
                        model.CompanyID = int.Parse(dt.Rows[n]["CompanyID"].ToString());
                    }
                    model.MaterielName = dt.Rows[n]["MaterielName"].ToString();
                    if (dt.Rows[n]["MaterielID"] != null && dt.Rows[n]["MaterielID"].ToString() != "")
                    {
                        model.MaterielID = int.Parse(dt.Rows[n]["MaterielID"].ToString());
                    }
                    model.TypeName = dt.Rows[n]["TypeName"].ToString();
                    if (dt.Rows[n]["PlanDate"] != null && dt.Rows[n]["PlanDate"].ToString() != "")
                    {
                        model.PlanDate = DateTime.Parse(dt.Rows[n]["PlanDate"].ToString());
                    }
                    model.SeriesName = dt.Rows[n]["SeriesName"].ToString();
                    if (dt.Rows[n]["OpenDate"] != null && dt.Rows[n]["OpenDate"].ToString() != "")
                    {
                        model.OpenDate = DateTime.Parse(dt.Rows[n]["OpenDate"].ToString());
                    }
                    if (dt.Rows[n]["LastDate"] != null && dt.Rows[n]["LastDate"].ToString() != "")
                    {
                        model.LastDate = DateTime.Parse(dt.Rows[n]["LastDate"].ToString());
                    }
                    if (dt.Rows[n]["StockBackDate"] != null && dt.Rows[n]["StockBackDate"].ToString() != "")
                    {
                        model.StockBackDate = DateTime.Parse(dt.Rows[n]["StockBackDate"].ToString());
                    }
                    if (dt.Rows[n]["TechDate"] != null && dt.Rows[n]["TechDate"].ToString() != "")
                    {
                        model.TechDate = DateTime.Parse(dt.Rows[n]["TechDate"].ToString());
                    }
                    model.Remark = dt.Rows[n]["Remark"].ToString();
                    if (dt.Rows[n]["FillManID"] != null && dt.Rows[n]["FillManID"].ToString() != "")
                    {
                        model.FillManID = int.Parse(dt.Rows[n]["FillManID"].ToString());
                    }
                    model.FillManName = dt.Rows[n]["FillManName"].ToString();
                    if (dt.Rows[n]["VerifyID"] != null && dt.Rows[n]["VerifyID"].ToString() != "")
                    {
                        model.VerifyID = int.Parse(dt.Rows[n]["VerifyID"].ToString());
                    }
                    model.VerifyName = dt.Rows[n]["VerifyName"].ToString();
                    if (dt.Rows[n]["FillDate"] != null && dt.Rows[n]["FillDate"].ToString() != "")
                    {
                        model.FillDate = DateTime.Parse(dt.Rows[n]["FillDate"].ToString());
                    }
                    if (dt.Rows[n]["VerifyDate"] != null && dt.Rows[n]["VerifyDate"].ToString() != "")
                    {
                        model.VerifyDate = DateTime.Parse(dt.Rows[n]["VerifyDate"].ToString());
                    }
                    if (dt.Rows[n]["UpData"] != null && dt.Rows[n]["UpData"].ToString() != "")
                    {
                        model.UpData = int.Parse(dt.Rows[n]["UpData"].ToString());
                    }
                    model.ProductName = dt.Rows[n]["ProductName"].ToString();
                    modelList.Add(model);
                }
            }
            return(modelList);
        }