/// <summary> /// 更新一条数据 /// </summary> public bool Update(KryptonAccessController.AccessDataBase.Model.ManagerRightList model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update ManagerRightList set "); strSql.Append("ManagerID=@ManagerID,"); strSql.Append("MenuID=@MenuID"); strSql.Append(" where ManagerRightListID=@ManagerRightListID "); SqlParameter[] parameters = { new SqlParameter("@ManagerID", SqlDbType.Int, 4), new SqlParameter("@MenuID", SqlDbType.Int, 4), new SqlParameter("@ManagerRightListID", SqlDbType.Int, 4) }; parameters[0].Value = model.ManagerID; parameters[1].Value = model.MenuID; parameters[2].Value = model.ManagerRightListID; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 得到一个对象实体 /// </summary> public KryptonAccessController.AccessDataBase.Model.ManagerRightList DataRowToModel(DataRow row) { KryptonAccessController.AccessDataBase.Model.ManagerRightList model=new KryptonAccessController.AccessDataBase.Model.ManagerRightList(); if (row != null) { if(row["ManagerRightListID"]!=null && row["ManagerRightListID"].ToString()!="") { model.ManagerRightListID=int.Parse(row["ManagerRightListID"].ToString()); } if(row["ManagerID"]!=null && row["ManagerID"].ToString()!="") { model.ManagerID=int.Parse(row["ManagerID"].ToString()); } if(row["MenuID"]!=null && row["MenuID"].ToString()!="") { model.MenuID=int.Parse(row["MenuID"].ToString()); } } return model; }
/// <summary> /// 得到一个对象实体 /// </summary> public KryptonAccessController.AccessDataBase.Model.ManagerRightList DataRowToModel(DataRow row) { KryptonAccessController.AccessDataBase.Model.ManagerRightList model = new KryptonAccessController.AccessDataBase.Model.ManagerRightList(); if (row != null) { if (row["ManagerRightListID"] != null && row["ManagerRightListID"].ToString() != "") { model.ManagerRightListID = int.Parse(row["ManagerRightListID"].ToString()); } if (row["ManagerID"] != null && row["ManagerID"].ToString() != "") { model.ManagerID = int.Parse(row["ManagerID"].ToString()); } if (row["MenuID"] != null && row["MenuID"].ToString() != "") { model.MenuID = int.Parse(row["MenuID"].ToString()); } } return(model); }
/// <summary> /// 得到一个对象实体 /// </summary> public KryptonAccessController.AccessDataBase.Model.ManagerRightList GetModel(int ManagerRightListID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 ManagerRightListID,ManagerID,MenuID from ManagerRightList "); strSql.Append(" where ManagerRightListID=@ManagerRightListID "); SqlParameter[] parameters = { new SqlParameter("@ManagerRightListID", SqlDbType.Int, 4) }; parameters[0].Value = ManagerRightListID; KryptonAccessController.AccessDataBase.Model.ManagerRightList model = new KryptonAccessController.AccessDataBase.Model.ManagerRightList(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 得到一个对象实体 /// </summary> public KryptonAccessController.AccessDataBase.Model.ManagerRightList GetModel(int ManagerRightListID) { StringBuilder strSql=new StringBuilder(); strSql.Append("select top 1 ManagerRightListID,ManagerID,MenuID from ManagerRightList "); strSql.Append(" where ManagerRightListID=@ManagerRightListID "); SqlParameter[] parameters = { new SqlParameter("@ManagerRightListID", SqlDbType.Int,4) }; parameters[0].Value = ManagerRightListID; KryptonAccessController.AccessDataBase.Model.ManagerRightList model=new KryptonAccessController.AccessDataBase.Model.ManagerRightList(); DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters); if(ds.Tables[0].Rows.Count>0) { return DataRowToModel(ds.Tables[0].Rows[0]); } else { return null; } }