Esempio n. 1
0
        /// <summary>
        /// 根据给定的主表编号,返回明细表的实体列表。
        /// </summary>
        /// <param name="iStockID">主表编号</param>
        /// <returns></returns>
        public List <lgk.Model.tb_StockDetail> GetModelList(long iStockID)
        {
            StringBuilder strSql = new StringBuilder();
            List <lgk.Model.tb_StockDetail> myList = new List <lgk.Model.tb_StockDetail>();

            DataSet ds = dal.GetList("StockID=" + iStockID + "");

            if (ds.Tables[0].Rows.Count == 0)
            {
                return(myList);
            }

            lgk.Model.tb_StockDetail model;
            foreach (DataRow row in ds.Tables[0].Rows)
            {
                model = new lgk.Model.tb_StockDetail();

                if (row["StockDetailID"] != null && row["StockDetailID"].ToString() != "")
                {
                    model.StockDetailID = int.Parse(row["StockDetailID"].ToString());
                }
                if (row["StockID"] != null && row["StockID"].ToString() != "")
                {
                    model.StockID = int.Parse(row["StockID"].ToString());
                }
                if (row["Amount"] != null && row["Amount"].ToString() != "")
                {
                    model.Amount = decimal.Parse(row["Amount"].ToString());
                }
                if (row["Price"] != null && row["Price"].ToString() != "")
                {
                    model.Price = decimal.Parse(row["Price"].ToString());
                }
                if (row["Number"] != null && row["Number"].ToString() != "")
                {
                    model.Number = int.Parse(row["Number"].ToString());
                }
                if (row["Periods"] != null && row["Periods"].ToString() != "")
                {
                    model.Periods = int.Parse(row["Periods"].ToString());
                }
                if (row["BuyDate"] != null && row["BuyDate"].ToString() != "")
                {
                    model.BuyDate = DateTime.Parse(row["BuyDate"].ToString());
                }
                myList.Add(model);
            }

            return(myList);
        }
Esempio n. 2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(lgk.Model.tb_StockDetail model)
 {
     return(dal.Update(model));
 }
Esempio n. 3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(lgk.Model.tb_StockDetail model)
 {
     return(dal.Add(model));
 }