예제 #1
0
        public List <Chain.Model.OrderDetail> DataTableToList(DataTable dt)
        {
            List <Chain.Model.OrderDetail> modelList = new List <Chain.Model.OrderDetail>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                for (int i = 0; i < rowsCount; i++)
                {
                    Chain.Model.OrderDetail model = new Chain.Model.OrderDetail();
                    if (dt.Rows[i]["OrderDetailID"] != null && dt.Rows[i]["OrderDetailID"].ToString() != "")
                    {
                        model.OrderDetailID = int.Parse(dt.Rows[i]["OrderDetailID"].ToString());
                    }
                    if (dt.Rows[i]["OrderID"] != null && dt.Rows[i]["OrderID"].ToString() != "")
                    {
                        model.OrderID = int.Parse(dt.Rows[i]["OrderID"].ToString());
                    }
                    if (dt.Rows[i]["GoodsID"] != null && dt.Rows[i]["GoodsID"].ToString() != "")
                    {
                        model.GoodsID = int.Parse(dt.Rows[i]["GoodsID"].ToString());
                    }
                    if (dt.Rows[i]["OrderDetailPrice"] != null && dt.Rows[i]["OrderDetailPrice"].ToString() != "")
                    {
                        model.OrderDetailPrice = decimal.Parse(dt.Rows[i]["OrderDetailPrice"].ToString());
                    }
                    if (dt.Rows[i]["OrderDetailPoint"] != null && dt.Rows[i]["OrderDetailPoint"].ToString() != "")
                    {
                        model.OrderDetailPoint = int.Parse(dt.Rows[i]["OrderDetailPoint"].ToString());
                    }
                    if (dt.Rows[i]["OrderDetailDiscountPrice"] != null && dt.Rows[i]["OrderDetailDiscountPrice"].ToString() != "")
                    {
                        model.OrderDetailDiscountPrice = decimal.Parse(dt.Rows[i]["OrderDetailDiscountPrice"].ToString());
                    }
                    if (dt.Rows[i]["OrderDetailNumber"] != null && dt.Rows[i]["OrderDetailNumber"].ToString() != "")
                    {
                        model.OrderDetailNumber = decimal.Parse(dt.Rows[i]["OrderDetailNumber"].ToString());
                    }
                    if (dt.Rows[i]["OrderDetailType"] != null && dt.Rows[i]["OrderDetailType"].ToString() != "")
                    {
                        model.OrderDetailType = int.Parse(dt.Rows[i]["OrderDetailType"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
예제 #2
0
 public int Update(Chain.Model.OrderDetail model)
 {
     return(this.dal.Update(model));
 }
예제 #3
0
 public int Add(Chain.Model.OrderDetail model)
 {
     return(this.dal.Add(model));
 }