示例#1
0
文件: tb_Stock.cs 项目: githexing/05
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public long Add(lgk.Model.tb_Stock model)
 {
     return(dal.Add(model));
 }
示例#2
0
文件: tb_Stock.cs 项目: githexing/05
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(lgk.Model.tb_Stock model)
 {
     return(dal.Update(model));
 }
示例#3
0
文件: tb_Stock.cs 项目: githexing/05
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <lgk.Model.tb_Stock> GetModelList(DataTable dt)
        {
            int iCount = dt.Rows.Count;
            List <lgk.Model.tb_Stock> myList = new List <lgk.Model.tb_Stock>();

            if (iCount > 0)
            {
                lgk.Model.tb_Stock model;
                foreach (DataRow row in dt.Rows)
                {
                    model = new lgk.Model.tb_Stock();
                    if (row["StockID"] != null && row["StockID"].ToString() != "")
                    {
                        model.StockID = long.Parse(row["StockID"].ToString());
                    }
                    if (row["UserID"] != null && row["UserID"].ToString() != "")
                    {
                        model.UserID = long.Parse(row["UserID"].ToString());
                    }
                    if (row["Amount"] != null && row["Amount"].ToString() != "")
                    {
                        model.Amount = decimal.Parse(row["Amount"].ToString());
                    }
                    if (row["BuyPrice"] != null && row["BuyPrice"].ToString() != "")
                    {
                        model.BuyPrice = decimal.Parse(row["BuyPrice"].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["Surplus"] != null && row["Surplus"].ToString() != "")
                    {
                        model.Surplus = int.Parse(row["Surplus"].ToString());
                    }
                    if (row["SplitNum"] != null && row["SplitNum"].ToString() != "")
                    {
                        model.SplitNum = int.Parse(row["SplitNum"].ToString());
                    }
                    if (row["BuyDate"] != null && row["BuyDate"].ToString() != "")
                    {
                        model.BuyDate = DateTime.Parse(row["BuyDate"].ToString());
                    }
                    if (row["IsLock"] != null && row["IsLock"].ToString() != "")
                    {
                        model.IsLock = int.Parse(row["IsLock"].ToString());
                    }
                    if (row["IsSell"] != null && row["IsSell"].ToString() != "")
                    {
                        model.IsSell = int.Parse(row["IsSell"].ToString());
                    }

                    myList.Add(model);
                }
            }
            return(myList);
        }