/// <summary> /// 获得数据列表 /// </summary> public List <Hotel_app.Model.Ygzdw> DataTableToList(DataTable dt) { List <Hotel_app.Model.Ygzdw> modelList = new List <Hotel_app.Model.Ygzdw>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { Hotel_app.Model.Ygzdw model; for (int n = 0; n < rowsCount; n++) { model = new Hotel_app.Model.Ygzdw(); if (dt.Rows[n]["ID"] != null && dt.Rows[n]["ID"].ToString() != "") { model.ID = int.Parse(dt.Rows[n]["ID"].ToString()); } if (dt.Rows[n]["dwrx"] != null && dt.Rows[n]["dwrx"].ToString() != "") { model.dwrx = dt.Rows[n]["dwrx"].ToString(); } if (dt.Rows[n]["gzdw"] != null && dt.Rows[n]["gzdw"].ToString() != "") { model.gzdw = dt.Rows[n]["gzdw"].ToString(); } if (dt.Rows[n]["nxr"] != null && dt.Rows[n]["nxr"].ToString() != "") { model.nxr = dt.Rows[n]["nxr"].ToString(); } if (dt.Rows[n]["nxdh"] != null && dt.Rows[n]["nxdh"].ToString() != "") { model.nxdh = dt.Rows[n]["nxdh"].ToString(); } if (dt.Rows[n]["nxcz"] != null && dt.Rows[n]["nxcz"].ToString() != "") { model.nxcz = dt.Rows[n]["nxcz"].ToString(); } if (dt.Rows[n]["Email"] != null && dt.Rows[n]["Email"].ToString() != "") { model.Email = dt.Rows[n]["Email"].ToString(); } if (dt.Rows[n]["nxdz"] != null && dt.Rows[n]["nxdz"].ToString() != "") { model.nxdz = dt.Rows[n]["nxdz"].ToString(); } if (dt.Rows[n]["xsy"] != null && dt.Rows[n]["xsy"].ToString() != "") { model.xsy = dt.Rows[n]["xsy"].ToString(); } if (dt.Rows[n]["zjm"] != null && dt.Rows[n]["zjm"].ToString() != "") { model.zjm = dt.Rows[n]["zjm"].ToString(); } modelList.Add(model); } } return(modelList); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Hotel_app.Model.Ygzdw model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(Hotel_app.Model.Ygzdw model) { return(dal.Add(model)); }