/// <summary> /// 获得数据列表 /// </summary> public List <ROYcms.Sys.Model.ROYcms_Transaction> DataTableToList(DataTable dt) { List <ROYcms.Sys.Model.ROYcms_Transaction> modelList = new List <ROYcms.Sys.Model.ROYcms_Transaction>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { ROYcms.Sys.Model.ROYcms_Transaction model; for (int n = 0; n < rowsCount; n++) { model = new ROYcms.Sys.Model.ROYcms_Transaction(); if (dt.Rows[n]["Id"] != null && dt.Rows[n]["Id"].ToString() != "") { model.Id = int.Parse(dt.Rows[n]["Id"].ToString()); } if (dt.Rows[n]["UserId"] != null && dt.Rows[n]["UserId"].ToString() != "") { model.UserId = int.Parse(dt.Rows[n]["UserId"].ToString()); } if (dt.Rows[n]["TradeType"] != null && dt.Rows[n]["TradeType"].ToString() != "") { model.TradeType = int.Parse(dt.Rows[n]["TradeType"].ToString()); } if (dt.Rows[n]["Price"] != null && dt.Rows[n]["Price"].ToString() != "") { model.Price = int.Parse(dt.Rows[n]["Price"].ToString()); } if (dt.Rows[n]["AccountBalance"] != null && dt.Rows[n]["AccountBalance"].ToString() != "") { model.AccountBalance = int.Parse(dt.Rows[n]["AccountBalance"].ToString()); } if (dt.Rows[n]["PayentMethord"] != null && dt.Rows[n]["PayentMethord"].ToString() != "") { model.PayentMethord = dt.Rows[n]["PayentMethord"].ToString(); } if (dt.Rows[n]["TradeExplaining"] != null && dt.Rows[n]["TradeExplaining"].ToString() != "") { model.TradeExplaining = dt.Rows[n]["TradeExplaining"].ToString(); } if (dt.Rows[n]["PaymentLogo"] != null && dt.Rows[n]["PaymentLogo"].ToString() != "") { model.PaymentLogo = dt.Rows[n]["PaymentLogo"].ToString(); } if (dt.Rows[n]["Remark"] != null && dt.Rows[n]["Remark"].ToString() != "") { model.Remark = dt.Rows[n]["Remark"].ToString(); } if (dt.Rows[n]["CreateTime"] != null && dt.Rows[n]["CreateTime"].ToString() != "") { model.CreateTime = DateTime.Parse(dt.Rows[n]["CreateTime"].ToString()); } modelList.Add(model); } } return(modelList); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(ROYcms.Sys.Model.ROYcms_Transaction model) { return(dal.Update(model)); }
/// <summary> /// 得到最大ID /// </summary> //public int GetMaxId() //{ // return dal.GetMaxId(); //} /// <summary> /// 是否存在该记录 /// </summary> //public bool Exists(int Id) //{ // return dal.Exists(Id); //} /// <summary> /// 增加一条数据 /// </summary> public int Add(ROYcms.Sys.Model.ROYcms_Transaction model) { return(dal.Add(model)); }