/// <summary> /// 增加一条数据 /// </summary> public long Add(lgk.Model.tb_Order model) { return(dal.Add(model)); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(lgk.Model.tb_Order model) { return(dal.Update(model)); }
/// <summary> /// 获得数据列表 /// </summary> public List <lgk.Model.tb_Order> DataTableToList(DataTable dt) { List <lgk.Model.tb_Order> modelList = new List <lgk.Model.tb_Order>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { lgk.Model.tb_Order model; for (int n = 0; n < rowsCount; n++) { model = new lgk.Model.tb_Order(); if (dt.Rows[n]["OrderID"] != null && dt.Rows[n]["OrderID"].ToString() != "") { model.OrderID = long.Parse(dt.Rows[n]["OrderID"].ToString()); } if (dt.Rows[n]["UserID"] != null && dt.Rows[n]["UserID"].ToString() != "") { model.UserID = long.Parse(dt.Rows[n]["UserID"].ToString()); } if (dt.Rows[n]["OrderCode"] != null && dt.Rows[n]["OrderCode"].ToString() != "") { model.OrderCode = dt.Rows[n]["OrderCode"].ToString(); } if (dt.Rows[n]["UserAddr"] != null && dt.Rows[n]["UserAddr"].ToString() != "") { model.UserAddr = dt.Rows[n]["UserAddr"].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 = decimal.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]["IsSend"] != null && dt.Rows[n]["IsSend"].ToString() != "") { model.IsSend = int.Parse(dt.Rows[n]["IsSend"].ToString()); } if (dt.Rows[n]["PayMethod"] != null && dt.Rows[n]["PayMethod"].ToString() != "") { model.PayMethod = int.Parse(dt.Rows[n]["PayMethod"].ToString()); } if (dt.Rows[n]["OrderType"] != null && dt.Rows[n]["OrderType"].ToString() != "") { model.OrderType = int.Parse(dt.Rows[n]["OrderType"].ToString()); } if (dt.Rows[n]["Order1"] != null && dt.Rows[n]["Order1"].ToString() != "") { model.Order1 = decimal.Parse(dt.Rows[n]["Order1"].ToString()); } if (dt.Rows[n]["Order2"] != null && dt.Rows[n]["Order2"].ToString() != "") { model.Order2 = decimal.Parse(dt.Rows[n]["Order2"].ToString()); } if (dt.Rows[n]["Order3"] != null && dt.Rows[n]["Order3"].ToString() != "") { model.Order3 = dt.Rows[n]["Order3"].ToString(); } if (dt.Rows[n]["Order4"] != null && dt.Rows[n]["Order4"].ToString() != "") { model.Order4 = dt.Rows[n]["Order4"].ToString(); } if (dt.Rows[n]["Order5"] != null && dt.Rows[n]["Order5"].ToString() != "") { model.Order5 = dt.Rows[n]["Order5"].ToString(); } if (dt.Rows[n]["Order6"] != null && dt.Rows[n]["Order6"].ToString() != "") { model.Order6 = dt.Rows[n]["Order6"].ToString(); } if (dt.Rows[n]["Order7"] != null && dt.Rows[n]["Order7"].ToString() != "") { model.Order7 = dt.Rows[n]["Order7"].ToString(); } modelList.Add(model); } } return(modelList); }