/// <summary> /// 获得数据列表 /// </summary> public List <Hotel_app.Model.X_judge_void> DataTableToList(DataTable dt) { List <Hotel_app.Model.X_judge_void> modelList = new List <Hotel_app.Model.X_judge_void>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { Hotel_app.Model.X_judge_void model; for (int n = 0; n < rowsCount; n++) { model = new Hotel_app.Model.X_judge_void(); if (dt.Rows[n]["id"] != null && dt.Rows[n]["id"].ToString() != "") { model.id = int.Parse(dt.Rows[n]["id"].ToString()); } if (dt.Rows[n]["yydh"] != null && dt.Rows[n]["yydh"].ToString() != "") { model.yydh = dt.Rows[n]["yydh"].ToString(); } if (dt.Rows[n]["qymc"] != null && dt.Rows[n]["qymc"].ToString() != "") { model.qymc = dt.Rows[n]["qymc"].ToString(); } if (dt.Rows[n]["judge_type"] != null && dt.Rows[n]["judge_type"].ToString() != "") { model.judge_type = dt.Rows[n]["judge_type"].ToString(); } if (dt.Rows[n]["judge_value"] != null && dt.Rows[n]["judge_value"].ToString() != "") { if ((dt.Rows[n]["judge_value"].ToString() == "1") || (dt.Rows[n]["judge_value"].ToString().ToLower() == "true")) { model.judge_value = true; } else { model.judge_value = false; } } if (dt.Rows[n]["bz"] != null && dt.Rows[n]["bz"].ToString() != "") { model.bz = dt.Rows[n]["bz"].ToString(); } if (dt.Rows[n]["is_top"] != null && dt.Rows[n]["is_top"].ToString() != "") { if ((dt.Rows[n]["is_top"].ToString() == "1") || (dt.Rows[n]["is_top"].ToString().ToLower() == "true")) { model.is_top = true; } else { model.is_top = false; } } if (dt.Rows[n]["is_select"] != null && dt.Rows[n]["is_select"].ToString() != "") { if ((dt.Rows[n]["is_select"].ToString() == "1") || (dt.Rows[n]["is_select"].ToString().ToLower() == "true")) { model.is_select = true; } else { model.is_select = false; } } modelList.Add(model); } } return(modelList); }