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

            if (rowsCount > 0)
            {
                RestaurantMIS.Model.CaiDan model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new RestaurantMIS.Model.CaiDan();
                    if (dt.Rows[n]["ID"].ToString() != "")
                    {
                        model.ID = int.Parse(dt.Rows[n]["ID"].ToString());
                    }
                    model.Category = dt.Rows[n]["Category"].ToString();
                    model.Name     = dt.Rows[n]["Name"].ToString();
                    if (dt.Rows[n]["Price"].ToString() != "")
                    {
                        model.Price = decimal.Parse(dt.Rows[n]["Price"].ToString());
                    }
                    if (dt.Rows[n]["LogDate"].ToString() != "")
                    {
                        model.LogDate = DateTime.Parse(dt.Rows[n]["LogDate"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Example #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(RestaurantMIS.Model.CaiDan model)
 {
     dal.Update(model);
 }
Example #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public void Add(RestaurantMIS.Model.CaiDan model)
 {
     dal.Add(model);
 }