예제 #1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <TSM.Model.pms_Product_Info> DataTableToList(DataTable dt)
        {
            List <TSM.Model.pms_Product_Info> modelList = new List <TSM.Model.pms_Product_Info>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                TSM.Model.pms_Product_Info model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new TSM.Model.pms_Product_Info();
                    if (dt.Rows[n]["ProductInfoID"].ToString() != "")
                    {
                        model.ProductInfoID = int.Parse(dt.Rows[n]["ProductInfoID"].ToString());
                    }
                    if (dt.Rows[n]["ProductBatchID"].ToString() != "")
                    {
                        model.ProductBatchID = int.Parse(dt.Rows[n]["ProductBatchID"].ToString());
                    }
                    if (dt.Rows[n]["CustomerRequireID"].ToString() != "")
                    {
                        model.CustomerRequireID = int.Parse(dt.Rows[n]["CustomerRequireID"].ToString());
                    }
                    if (dt.Rows[n]["ProductTypeID"].ToString() != "")
                    {
                        model.ProductTypeID = int.Parse(dt.Rows[n]["ProductTypeID"].ToString());
                    }
                    if (dt.Rows[n]["ProductStrucID"].ToString() != "")
                    {
                        model.ProductStrucID = int.Parse(dt.Rows[n]["ProductStrucID"].ToString());
                    }
                    if (dt.Rows[n]["ProductMaterID"].ToString() != "")
                    {
                        model.ProductMaterID = int.Parse(dt.Rows[n]["ProductMaterID"].ToString());
                    }
                    if (dt.Rows[n]["ProductIndustID"].ToString() != "")
                    {
                        model.ProductIndustID = int.Parse(dt.Rows[n]["ProductIndustID"].ToString());
                    }
                    model.ProductInfoName = dt.Rows[n]["ProductInfoName"].ToString();
                    model.ProductPhotoNum = dt.Rows[n]["ProductPhotoNum"].ToString();
                    model.ProductStandard = dt.Rows[n]["ProductStandard"].ToString();
                    if (dt.Rows[n]["ProductWeight"].ToString() != "")
                    {
                        model.ProductWeight = decimal.Parse(dt.Rows[n]["ProductWeight"].ToString());
                    }
                    model.OrderQuantity = dt.Rows[n]["OrderQuantity"].ToString();
                    model.ContourSize   = dt.Rows[n]["ContourSize"].ToString();
                    model.Remarks       = dt.Rows[n]["Remarks"].ToString();
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
예제 #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(TSM.Model.pms_Product_Info model)
 {
     dal.Update(model);
 }
예제 #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(TSM.Model.pms_Product_Info model)
 {
     return(dal.Add(model));
 }