/// <summary> /// 增加一条数据 /// </summary> public int Add(BWJS.Model.RoleFunction model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into RoleFunction("); strSql.Append("RoleFunctionId,RoleId,FunctionId,CreateId,CreateDate,EditId,EditDate,IsDeleted"); strSql.Append(") values ("); strSql.Append("@RoleFunctionId,@RoleId,@FunctionId,@CreateId,@CreateDate,@EditId,@EditDate,@IsDeleted"); strSql.Append(") "); strSql.Append(";select SCOPE_IDENTITY()"); SqlParameter[] parameters = { new SqlParameter("@RoleFunctionId", model.RoleFunctionId), new SqlParameter("@RoleId", model.RoleId), new SqlParameter("@FunctionId", model.FunctionId), new SqlParameter("@CreateId", model.CreateId), new SqlParameter("@CreateDate", model.CreateDate), new SqlParameter("@EditId", model.EditId), new SqlParameter("@EditDate", model.EditDate), new SqlParameter("@IsDeleted", model.IsDeleted) }; object obj = BWJSHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
/// <summary> /// 得到一个对象实体 /// </summary> public BWJS.Model.RoleFunction GetModel(int RoleFunctionId) { StringBuilder strSql = new StringBuilder(); strSql.Append("select RoleFunctionId, RoleId, FunctionId, CreateId, CreateDate, EditId, EditDate, IsDeleted "); strSql.Append(" from RoleFunction "); strSql.Append(" where RoleFunctionId=@RoleFunctionId "); SqlParameter[] parameters = { new SqlParameter("@RoleFunctionId", SqlDbType.Int, 4) }; parameters[0].Value = RoleFunctionId; BWJS.Model.RoleFunction model = new BWJS.Model.RoleFunction(); DataSet ds = BWJSHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
/// <summary> /// 增加一条数据 /// </summary> public int Add(BWJS.Model.RoleFunction model) { int id = 0; id = dal.Add(model); return(id); }
/// <summary> /// datarow转成对象实体 /// </summary> public BWJS.Model.RoleFunction DataRowToModel(DataRow row) { BWJS.Model.RoleFunction model = new BWJS.Model.RoleFunction(); if (row != null) { if (row["RoleFunctionId"].ToString() != "") { model.RoleFunctionId = int.Parse(row["RoleFunctionId"].ToString()); } if (row["RoleId"].ToString() != "") { model.RoleId = int.Parse(row["RoleId"].ToString()); } if (row["FunctionId"].ToString() != "") { model.FunctionId = int.Parse(row["FunctionId"].ToString()); } if (row["CreateId"].ToString() != "") { model.CreateId = int.Parse(row["CreateId"].ToString()); } if (row["CreateDate"].ToString() != "") { model.CreateDate = DateTime.Parse(row["CreateDate"].ToString()); } if (row["EditId"].ToString() != "") { model.EditId = int.Parse(row["EditId"].ToString()); } if (row["EditDate"].ToString() != "") { model.EditDate = DateTime.Parse(row["EditDate"].ToString()); } if (row["IsDeleted"].ToString() != "") { model.IsDeleted = int.Parse(row["IsDeleted"].ToString()); } return(model); } else { return(null); } }
/// <summary> /// 得到一个对象实体 /// </summary> public DataSet GetAssignCheck(int RoleId) { StringBuilder strSql = new StringBuilder(); strSql.Append("select * "); strSql.Append(" from RoleFunction "); strSql.Append(" where RoleId=@RoleId and IsDeleted=0"); SqlParameter[] parameters = { new SqlParameter("@RoleId", SqlDbType.Int, 4) }; parameters[0].Value = RoleId; BWJS.Model.RoleFunction model = new BWJS.Model.RoleFunction(); DataSet ds = BWJSHelperSQL.Query(strSql.ToString(), parameters); return(ds); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(BWJS.Model.RoleFunction model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update RoleFunction set "); strSql.Append(" RoleFunctionId = @RoleFunctionId , "); strSql.Append(" RoleId = @RoleId , "); strSql.Append(" FunctionId = @FunctionId , "); strSql.Append(" CreateId = @CreateId , "); strSql.Append(" CreateDate = @CreateDate , "); strSql.Append(" EditId = @EditId , "); strSql.Append(" EditDate = @EditDate , "); strSql.Append(" IsDeleted = @IsDeleted "); strSql.Append(" where RoleFunctionId=@RoleFunctionId "); SqlParameter[] parameters = { new SqlParameter("@RoleFunctionId", model.RoleFunctionId), new SqlParameter("@RoleId", model.RoleId), new SqlParameter("@FunctionId", model.FunctionId), new SqlParameter("@CreateId", model.CreateId), new SqlParameter("@CreateDate", model.CreateDate), new SqlParameter("@EditId", model.EditId), new SqlParameter("@EditDate", model.EditDate), new SqlParameter("@IsDeleted", model.IsDeleted) }; int rows = BWJSHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(BWJS.Model.RoleFunction model) { return(dal.Update(model)); }