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

            if (rowsCount > 0)
            {
                Hownet.Model.ProduceSellOne model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Hownet.Model.ProduceSellOne();
                    if (dt.Rows[n]["ID"].ToString() != "")
                    {
                        model.ID = int.Parse(dt.Rows[n]["ID"].ToString());
                    }
                    else
                    {
                        model.ID = 0;
                    }
                    if (dt.Rows[n]["MaterielID"].ToString() != "")
                    {
                        model.MaterielID = int.Parse(dt.Rows[n]["MaterielID"].ToString());
                    }
                    else
                    {
                        model.MaterielID = 0;
                    }
                    if (dt.Rows[n]["Price"].ToString() != "")
                    {
                        model.Price = decimal.Parse(dt.Rows[n]["Price"].ToString());
                    }
                    else
                    {
                        model.Price = 0;
                    }
                    if (dt.Rows[n]["Amount"].ToString() != "")
                    {
                        model.Amount = decimal.Parse(dt.Rows[n]["Amount"].ToString());
                    }
                    else
                    {
                        model.Amount = 0;
                    }
                    if (dt.Rows[n]["Money"].ToString() != "")
                    {
                        model.Money = decimal.Parse(dt.Rows[n]["Money"].ToString());
                    }
                    else
                    {
                        model.Money = 0;
                    }
                    model.Remark = dt.Rows[n]["Remark"].ToString();
                    if (dt.Rows[n]["MainID"].ToString() != "")
                    {
                        model.MainID = int.Parse(dt.Rows[n]["MainID"].ToString());
                    }
                    else
                    {
                        model.MainID = 0;
                    }
                    if (dt.Rows[n]["MeasureID"].ToString() != "")
                    {
                        model.MeasureID = int.Parse(dt.Rows[n]["MeasureID"].ToString());
                    }
                    else
                    {
                        model.MeasureID = 0;
                    }
                    if (dt.Rows[n]["BoxMeasureID"].ToString() != "")
                    {
                        model.BoxMeasureID = int.Parse(dt.Rows[n]["BoxMeasureID"].ToString());
                    }
                    else
                    {
                        model.BoxMeasureID = 0;
                    }
                    if (dt.Rows[n]["Conversion"].ToString() != "")
                    {
                        model.Conversion = int.Parse(dt.Rows[n]["Conversion"].ToString());
                    }
                    else
                    {
                        model.Conversion = 0;
                    }
                    if (dt.Rows[n]["BoxMeasureAmount"].ToString() != "")
                    {
                        model.BoxMeasureAmount = int.Parse(dt.Rows[n]["BoxMeasureAmount"].ToString());
                    }
                    else
                    {
                        model.BoxMeasureAmount = 0;
                    }
                    if (dt.Rows[n]["BrandID"].ToString() != "")
                    {
                        model.BrandID = int.Parse(dt.Rows[n]["BrandID"].ToString());
                    }
                    else
                    {
                        model.BrandID = 0;
                    }
                    if (dt.Rows[n]["SalesOrderInfoID"].ToString() != "")
                    {
                        model.SalesOrderInfoID = int.Parse(dt.Rows[n]["SalesOrderInfoID"].ToString());
                    }
                    else
                    {
                        model.SalesOrderInfoID = 0;
                    }
                    if (dt.Rows[n]["RemarkID"].ToString() != "")
                    {
                        model.RemarkID = int.Parse(dt.Rows[n]["RemarkID"].ToString());
                    }
                    else
                    {
                        model.RemarkID = 0;
                    }
                    if (dt.Rows[n]["MTID"].ToString() != "")
                    {
                        model.MTID = int.Parse(dt.Rows[n]["MTID"].ToString());
                    }
                    else
                    {
                        model.MTID = 0;
                    }
                    model.SellRemark = dt.Rows[n]["SellRemark"].ToString();
                    try
                    {
                        model.CompanyMaterielName = dt.Rows[n]["CompanyMaterielName"].ToString();
                    }
                    catch (Exception ex)
                    {
                        model.CompanyMaterielName = string.Empty;
                    }
                    model.A = int.Parse(dt.Rows[n]["A"].ToString());
                    modelList.Add(model);
                }
            }
            return(modelList);
        }