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

            if (rowsCount > 0)
            {
                ZhangWei.Model.EnterStock_Detail model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new ZhangWei.Model.EnterStock_Detail();
                    if (dt.Rows[n]["EnterStock_ID"] != null && dt.Rows[n]["EnterStock_ID"].ToString() != "")
                    {
                        model.EnterStock_ID = int.Parse(dt.Rows[n]["EnterStock_ID"].ToString());
                    }
                    if (dt.Rows[n]["Product_ID"] != null && dt.Rows[n]["Product_ID"].ToString() != "")
                    {
                        model.Product_ID = int.Parse(dt.Rows[n]["Product_ID"].ToString());
                    }
                    if (dt.Rows[n]["Quantity"] != null && dt.Rows[n]["Quantity"].ToString() != "")
                    {
                        model.Quantity = decimal.Parse(dt.Rows[n]["Quantity"].ToString());
                    }
                    if (dt.Rows[n]["Price"] != null && dt.Rows[n]["Price"].ToString() != "")
                    {
                        model.Price = decimal.Parse(dt.Rows[n]["Price"].ToString());
                    }
                    if (dt.Rows[n]["HaveInvoice"] != null && dt.Rows[n]["HaveInvoice"].ToString() != "")
                    {
                        if ((dt.Rows[n]["HaveInvoice"].ToString() == "1") || (dt.Rows[n]["HaveInvoice"].ToString().ToLower() == "true"))
                        {
                            model.HaveInvoice = true;
                        }
                        else
                        {
                            model.HaveInvoice = false;
                        }
                    }
                    if (dt.Rows[n]["InvoiceNum"] != null && dt.Rows[n]["InvoiceNum"].ToString() != "")
                    {
                        model.InvoiceNum = dt.Rows[n]["InvoiceNum"].ToString();
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Exemple #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(ZhangWei.Model.EnterStock_Detail model)
 {
     return(dal.Update(model));
 }
Exemple #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(ZhangWei.Model.EnterStock_Detail model)
 {
     return(dal.Add(model));
 }