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

            if (rowsCount > 0)
            {
                lgk.Model.tb_OrderDetail model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new lgk.Model.tb_OrderDetail();
                    if (dt.Rows[n]["ID"] != null && dt.Rows[n]["ID"].ToString() != "")
                    {
                        model.ID = int.Parse(dt.Rows[n]["ID"].ToString());
                    }
                    if (dt.Rows[n]["OrderCode"] != null && dt.Rows[n]["OrderCode"].ToString() != "")
                    {
                        model.OrderCode = dt.Rows[n]["OrderCode"].ToString();
                    }
                    if (dt.Rows[n]["ProcudeID"] != null && dt.Rows[n]["ProcudeID"].ToString() != "")
                    {
                        model.ProcudeID = int.Parse(dt.Rows[n]["ProcudeID"].ToString());
                    }
                    if (dt.Rows[n]["ProcudeName"] != null && dt.Rows[n]["ProcudeName"].ToString() != "")
                    {
                        model.ProcudeName = dt.Rows[n]["ProcudeName"].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]["PV"] != null && dt.Rows[n]["PV"].ToString() != "")
                    {
                        model.PV = int.Parse(dt.Rows[n]["PV"].ToString());
                    }
                    if (dt.Rows[n]["OrderSum"] != null && dt.Rows[n]["OrderSum"].ToString() != "")
                    {
                        model.OrderSum = int.Parse(dt.Rows[n]["OrderSum"].ToString());
                    }
                    if (dt.Rows[n]["OrderTotal"] != null && dt.Rows[n]["OrderTotal"].ToString() != "")
                    {
                        model.OrderTotal = decimal.Parse(dt.Rows[n]["OrderTotal"].ToString());
                    }
                    if (dt.Rows[n]["PVTotal"] != null && dt.Rows[n]["PVTotal"].ToString() != "")
                    {
                        model.PVTotal = int.Parse(dt.Rows[n]["PVTotal"].ToString());
                    }
                    if (dt.Rows[n]["OrderDate"] != null && dt.Rows[n]["OrderDate"].ToString() != "")
                    {
                        model.OrderDate = DateTime.Parse(dt.Rows[n]["OrderDate"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Exemple #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(lgk.Model.tb_OrderDetail model)
 {
     return(dal.Update(model));
 }
Exemple #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public long Add(lgk.Model.tb_OrderDetail model)
 {
     return(dal.Add(model));
 }
Exemple #4
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <lgk.Model.tb_OrderDetail> GetJoinListAll(string strWhere)
        {
            DataSet   ds = dal.GetJoinListAll(strWhere);
            DataTable dt = ds.Tables[0];

            List <lgk.Model.tb_OrderDetail> modelList = new List <lgk.Model.tb_OrderDetail>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                lgk.Model.tb_OrderDetail model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new lgk.Model.tb_OrderDetail();
                    if (dt.Rows[n]["ID"] != null && dt.Rows[n]["ID"].ToString() != "")
                    {
                        model.ID = int.Parse(dt.Rows[n]["ID"].ToString());
                    }
                    if (dt.Rows[n]["OrderCode"] != null && dt.Rows[n]["OrderCode"].ToString() != "")
                    {
                        model.OrderCode = dt.Rows[n]["OrderCode"].ToString();
                    }
                    if (dt.Rows[n]["ProcudeID"] != null && dt.Rows[n]["ProcudeID"].ToString() != "")
                    {
                        model.ProcudeID = int.Parse(dt.Rows[n]["ProcudeID"].ToString());
                    }
                    if (dt.Rows[n]["ProcudeName"] != null && dt.Rows[n]["ProcudeName"].ToString() != "")
                    {
                        model.ProcudeName = dt.Rows[n]["ProcudeName"].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]["PV"] != null && dt.Rows[n]["PV"].ToString() != "")
                    {
                        model.PV = int.Parse(dt.Rows[n]["PV"].ToString());
                    }
                    if (dt.Rows[n]["OrderSum"] != null && dt.Rows[n]["OrderSum"].ToString() != "")
                    {
                        model.OrderSum = int.Parse(dt.Rows[n]["OrderSum"].ToString());
                    }
                    if (dt.Rows[n]["OrderTotal"] != null && dt.Rows[n]["OrderTotal"].ToString() != "")
                    {
                        model.OrderTotal = decimal.Parse(dt.Rows[n]["OrderTotal"].ToString());
                    }
                    if (dt.Rows[n]["PVTotal"] != null && dt.Rows[n]["PVTotal"].ToString() != "")
                    {
                        model.PVTotal = int.Parse(dt.Rows[n]["PVTotal"].ToString());
                    }
                    if (dt.Rows[n]["OrderDate"] != null && dt.Rows[n]["OrderDate"].ToString() != "")
                    {
                        model.OrderDate = DateTime.Parse(dt.Rows[n]["OrderDate"].ToString());
                    }
                    if (dt.Rows[n]["UserID"] != null && dt.Rows[n]["UserID"].ToString() != "")
                    {
                        model.UserID = long.Parse(dt.Rows[n]["UserID"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }