/// <summary> /// 增加一条数据 /// </summary> public int Add(Hotel_app.Model.YH_Roles model) { return(dal.Add(model)); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Hotel_app.Model.YH_Roles model) { return(dal.Update(model)); }
/// <summary> /// 获得数据列表 /// </summary> public List <Hotel_app.Model.YH_Roles> DataTableToList(DataTable dt) { List <Hotel_app.Model.YH_Roles> modelList = new List <Hotel_app.Model.YH_Roles>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { Hotel_app.Model.YH_Roles model; for (int n = 0; n < rowsCount; n++) { model = new Hotel_app.Model.YH_Roles(); 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]["R_lsbh"] != null && dt.Rows[n]["R_lsbh"].ToString() != "") { model.R_lsbh = dt.Rows[n]["R_lsbh"].ToString(); } if (dt.Rows[n]["R_RolesName"] != null && dt.Rows[n]["R_RolesName"].ToString() != "") { model.R_RolesName = dt.Rows[n]["R_RolesName"].ToString(); } if (dt.Rows[n]["R_Bz"] != null && dt.Rows[n]["R_Bz"].ToString() != "") { model.R_Bz = dt.Rows[n]["R_Bz"].ToString(); } if (dt.Rows[n]["R_ts"] != null && dt.Rows[n]["R_ts"].ToString() != "") { model.R_ts = int.Parse(dt.Rows[n]["R_ts"].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); }