/// <summary> /// 得到一个对象实体 /// </summary> public tb_settings Find() { StringBuilder strSql = new StringBuilder(); strSql.Append("select id, PicSaveStyle, PicPath,isNeedRate"); strSql.Append(" from tb_Settings "); tb_settings model = new tb_settings(); DataSet ds = dbl.ds(strSql.ToString()); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["id"].ToString() != "") { model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString()); } if (ds.Tables[0].Rows[0]["PicSaveStyle"].ToString() != "") { model.PicSaveStyle = int.Parse(ds.Tables[0].Rows[0]["PicSaveStyle"].ToString()); } model.PicPath = ds.Tables[0].Rows[0]["PicPath"].ToString(); if (ds.Tables[0].Rows[0]["isNeedRate"].ToString() != "") { model.IsNeedRate = int.Parse(ds.Tables[0].Rows[0]["isNeedRate"].ToString()); } return(model); } else { return(null); } }
/// <summary> /// 得到一个对象实体 /// </summary> public BaseMenu GetModel(int MenuId) { StringBuilder strSql = new StringBuilder(); strSql.Append("select MenuId, Memo, Image, UrlId, UrlName, BindSQL, WorkId, SortId, Name, DllName, FunName, ModuleId, PMenuId, MenuToolBar, MenuLookBar "); strSql.Append(" from BaseMenu "); strSql.Append(" where MenuId=@MenuId"); SqlParameter[] parameters = { new SqlParameter("@MenuId", SqlDbType.Int, 4) }; parameters[0].Value = MenuId; BaseMenu model = new BaseMenu(); DataSet ds = dbc.ds(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["MenuId"].ToString() != "") { model.MenuId = int.Parse(ds.Tables[0].Rows[0]["MenuId"].ToString()); } model.Memo = ds.Tables[0].Rows[0]["Memo"].ToString(); if (ds.Tables[0].Rows[0]["SortId"].ToString() != "") { model.SortId = int.Parse(ds.Tables[0].Rows[0]["SortId"].ToString()); } model.Name = ds.Tables[0].Rows[0]["Name"].ToString(); if (ds.Tables[0].Rows[0]["ModuleId"].ToString() != "") { model.ModuleId = int.Parse(ds.Tables[0].Rows[0]["ModuleId"].ToString()); } if (ds.Tables[0].Rows[0]["PMenuId"].ToString() != "") { model.PMenuId = int.Parse(ds.Tables[0].Rows[0]["PMenuId"].ToString()); } return(model); } else { return(null); } }
public Dictionary <int, string> getMenuDic(int groupid) { Dictionary <int, string> menu = new Dictionary <int, string>(); string sql = "select GroupId,a.ModuleId,a.MenuId,b.Name from BaseGroupMenu a " + " left join BaseMenu b on a.menuid = b.menuid where a.groupid =" + groupid; DataSet ds = dbc.ds(sql); if (ds != null) { if (ds.Tables.Count > 0) { if (ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { menu.Add(Convert.ToInt16(ds.Tables[0].Rows[i]["MenuId"]), ds.Tables[0].Rows[i]["Name"].ToString()); } } } } return(menu); }
/// <summary> /// 得到一个对象实体 /// </summary> public BaseModule GetModel(int ModuleId) { StringBuilder strSql = new StringBuilder(); strSql.Append("select ModuleId, Name, Memo, SortId "); strSql.Append(" from BaseModule "); strSql.Append(" where ModuleId=@ModuleId"); SqlParameter[] parameters = { new SqlParameter("@ModuleId", SqlDbType.Int, 4) }; parameters[0].Value = ModuleId; BaseModule model = new BaseModule(); DataSet ds = dbc.ds(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["ModuleId"].ToString() != "") { model.ModuleId = int.Parse(ds.Tables[0].Rows[0]["ModuleId"].ToString()); } model.Name = ds.Tables[0].Rows[0]["Name"].ToString(); model.Memo = ds.Tables[0].Rows[0]["Memo"].ToString(); if (ds.Tables[0].Rows[0]["SortId"].ToString() != "") { model.SortId = int.Parse(ds.Tables[0].Rows[0]["SortId"].ToString()); } return(model); } else { return(null); } }