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

            if (rowsCount > 0)
            {
                Hownet.Model.StockBackInfoList model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Hownet.Model.StockBackInfoList();
                    if (dt.Rows[n]["ID"].ToString() != "")
                    {
                        model.ID = int.Parse(dt.Rows[n]["ID"].ToString());
                    }
                    else
                    {
                        model.ID = 0;
                    }
                    if (dt.Rows[n]["InfoID"].ToString() != "")
                    {
                        model.InfoID = int.Parse(dt.Rows[n]["InfoID"].ToString());
                    }
                    else
                    {
                        model.InfoID = 0;
                    }
                    if (dt.Rows[n]["Amount"].ToString() != "")
                    {
                        model.Amount = decimal.Parse(dt.Rows[n]["Amount"].ToString());
                    }
                    else
                    {
                        model.Amount = 0;
                    }
                    model.Remark = dt.Rows[n]["Remark"].ToString();
                    if (dt.Rows[n]["IsOK"].ToString() != "")
                    {
                        if ((dt.Rows[n]["IsOK"].ToString() == "1") || (dt.Rows[n]["IsOK"].ToString().ToLower() == "true"))
                        {
                            model.IsOK = true;
                        }
                        else
                        {
                            model.IsOK = false;
                        }
                    }
                    if (dt.Rows[n]["BatchNumber"].ToString() != "")
                    {
                        model.BatchNumber = int.Parse(dt.Rows[n]["BatchNumber"].ToString());
                    }
                    else
                    {
                        model.BatchNumber = 0;
                    }
                    if (dt.Rows[n]["NotAmount"].ToString() != "")
                    {
                        model.NotAmount = decimal.Parse(dt.Rows[n]["NotAmount"].ToString());
                    }
                    else
                    {
                        model.NotAmount = 0;
                    }
                    if (dt.Rows[n]["SpecID"] != null && dt.Rows[n]["SpecID"].ToString() != "")
                    {
                        model.SpecID = int.Parse(dt.Rows[n]["SpecID"].ToString());
                    }
                    if (dt.Rows[n]["DepotInfoID"] != null && dt.Rows[n]["DepotInfoID"].ToString() != "")
                    {
                        model.DepotInfoID = int.Parse(dt.Rows[n]["DepotInfoID"].ToString());
                    }
                    if (dt.Rows[n]["MainID"] != null && dt.Rows[n]["MainID"].ToString() != "")
                    {
                        model.MainID = int.Parse(dt.Rows[n]["MainID"].ToString());
                    }
                    model.QRID = dt.Rows[n]["QRID"].ToString();
                    if (dt.Rows[n]["NowAmount"] != null && dt.Rows[n]["NowAmount"].ToString() != "")
                    {
                        model.NowAmount = decimal.Parse(dt.Rows[n]["NowAmount"].ToString());
                    }
                    if (dt.Rows[n]["RListID"] != null && dt.Rows[n]["RListID"].ToString() != "")
                    {
                        model.RListID = int.Parse(dt.Rows[n]["RListID"].ToString());
                    }
                    model.A = int.Parse(dt.Rows[n]["A"].ToString());
                    modelList.Add(model);
                }
            }
            return(modelList);
        }