public bool DeleteComent(Coment coment) { var parameters = new DataAccessParameter[1]; parameters[0] = new DataAccessParameter("@ComentId", coment.ComentId, typeof(int), null, ParameterDirection.Input); return(1 == WikiDBAdapter.ExecuteStoredProcedure("DeleteComent", parameters)); }
public bool UpdatePushNotificationNews(User user) { var inputParameters = new DataAccessParameter[1]; inputParameters[0] = new DataAccessParameter("@NewsItemId", user.UserId, typeof(int)); return(1 == WikiDBAdapter.ExecuteStoredProcedure("UpdatePushNotificationNews", inputParameters)); }
public bool DeletePost(Post post) { var parameters = new DataAccessParameter[1]; parameters[0] = new DataAccessParameter("@PostId", post.PostId, typeof(int), null, ParameterDirection.Input); return(1 == WikiDBAdapter.ExecuteStoredProcedure("DeletePost", parameters)); }
public int CountCompanyActiveUsersInvArea(string search_column, string search_data) { var outputParameter = new DataAccessParameter("@count", null, typeof(string), null, ParameterDirection.Output); WikiDBAdapter.ExecuteStoredProcedure("CountCompanyActiveUsersInvArea", outputParameter, new DataAccessParameter("@search_column", search_column, typeof(int), ParameterDirection.Input), new DataAccessParameter("@search_data", search_data, typeof(string), ParameterDirection.Input)); return(Convert.ToInt32(outputParameter.Value)); }
public void Constructor() { //---------------Set up test pack------------------- //---------------Assert Precondition---------------- //---------------Execute Test ---------------------- var dataAccessParameter = new DataAccessParameter("test", typeof(string)); //---------------Test Result ----------------------- dataAccessParameter.Should().NotBeNull(); }
/// <summary> /// 添加参数 /// </summary> /// <param name="command"></param> /// <param name="parameter"></param> protected override void AddParameter(DbCommand command, DataAccessParameter parameter) { SQLiteCommand comm = command as SQLiteCommand; if (comm != null) { comm.Parameters.AddWithValue(parameter.ParameterName, parameter.ParameterValue); comm.Parameters[parameter.ParameterName].Direction = parameter.Direction; } }
public bool InsertComent(Coment coment) { var parameters = new DataAccessParameter[4]; parameters[0] = new DataAccessParameter("@PostId", coment.Post.PostId, typeof(int), null, ParameterDirection.Input); parameters[1] = new DataAccessParameter("@ComentReferenceId", coment.ComentReferenceId, typeof(int), null, ParameterDirection.Input); parameters[2] = new DataAccessParameter("@ComentText", coment.ComentText, typeof(int), null, ParameterDirection.Input); parameters[3] = new DataAccessParameter("@UserId", coment.User.UserId, typeof(int), null, ParameterDirection.Input); return(1 == WikiDBAdapter.ExecuteStoredProcedure("InsertComent", parameters)); }
/// <summary> /// 添加参数 /// </summary> /// <param name="command"></param> /// <param name="parameter"></param> protected override void AddParameter(DbCommand command, DataAccessParameter parameter) { OracleCommand comm = command as OracleCommand; if (comm != null) { comm.Parameters.AddWithValue(parameter.ParameterName, parameter.ParameterValue); comm.Parameters[parameter.ParameterName].Direction = parameter.Direction; comm.Parameters[parameter.ParameterName].Size = parameter.Size; //Lucas 2011-01-04 执行oracle存储过程时参数必须要设置大小 //comm.Parameters[parameter.ParameterName].DbType = parameter.DbType; } }
public User GetUserByUserName(string userName) { DataAccessParameter[] parameters = new DataAccessParameter[1]; parameters[0] = new DataAccessParameter("@UserName", userName, typeof(string), null, ParameterDirection.Input); DataTable dt = WikiDBAdapter.GetDataTable("GetUserByUserName", parameters); User user = new User(); if (dt != null && dt.Rows.Count > 0) { var dsm = new DataSetMapper <User>(); user = dsm.ConvertSingleFromBackend(dt.Rows[0]); } return(user); }
public bool IsUserOwnerComent(Coment coment, User user) { DataAccessParameter[] parameters = new DataAccessParameter[2]; parameters[0] = new DataAccessParameter("@ComentId", coment.ComentId, typeof(int), null, ParameterDirection.Input); parameters[1] = new DataAccessParameter("@UserId", user.UserId, typeof(int), null, ParameterDirection.Input); DataTable dt = WikiDBAdapter.GetDataTable("IsUserOwnerComent", parameters); bool result = false; if (dt != null && dt.Rows.Count > 0) { result = true; } return(result); }
/// <summary> /// Obtiene la información de un post por id /// </summary> /// <param name="post">Post con el id</param> /// <returns></returns> public Post GetPostById(Post post) { DataAccessParameter[] parameters = new DataAccessParameter[1]; parameters[0] = new DataAccessParameter("@PostId", post.PostId, typeof(int), null, ParameterDirection.Input); DataTable dt = WikiDBAdapter.GetDataTable("GetPostById", parameters); Post result = new Post(); if (dt != null && dt.Rows.Count > 0) { var dsm = new DataSetMapper <Post>(); result = dsm.ConvertSingleFromBackend(dt.Rows[0]); } return(result); }
public bool UpdatePost(Post post) { var parameters = new DataAccessParameter[8]; parameters[0] = new DataAccessParameter("@PostId", post.PostId, typeof(int), null, ParameterDirection.Input); parameters[1] = new DataAccessParameter("@TopicId", post.Topic.TopicId, typeof(int), null, ParameterDirection.Input); parameters[2] = new DataAccessParameter("@SubTopicId", post.SubTopic.SubTopicId, typeof(int), null, ParameterDirection.Input); parameters[3] = new DataAccessParameter("@UserId", post.User.UserId, typeof(int), null, ParameterDirection.Input); parameters[4] = new DataAccessParameter("@DifficultyLevelId", post.DifficultyLevel.DifficultyLevelId, typeof(int), null, ParameterDirection.Input); parameters[5] = new DataAccessParameter("@Tags", post.Tags, typeof(string), null, ParameterDirection.Input); parameters[6] = new DataAccessParameter("@ContentPost", post.ContentPost, typeof(string), null, ParameterDirection.Input); parameters[7] = new DataAccessParameter("@Title", post.Title, typeof(string), null, ParameterDirection.Input); return(1 == WikiDBAdapter.ExecuteStoredProcedure("UpdatePost", parameters)); }
/// <summary> /// 添加参数 /// </summary> /// <param name="command"></param> /// <param name="parameter"></param> protected override void AddParameter(DbCommand command, DataAccessParameter parameter) { OracleCommand comm = command as OracleCommand; if (comm != null) { comm.Parameters.AddWithValue(parameter.ParameterName, parameter.ParameterValue); comm.Parameters[parameter.ParameterName].Direction = parameter.Direction; //comm.Parameters[parameter.ParameterName].DbType = parameter.DbType; if (parameter.Size != 0) { comm.Parameters[parameter.ParameterName].Size = parameter.Size; } } }
public Post InsertPost(Post post) { var parameters = new DataAccessParameter[7]; parameters[0] = new DataAccessParameter("@TopicId", post.Topic.TopicId, typeof(int), null, ParameterDirection.Input); parameters[1] = new DataAccessParameter("@SubTopicId", post.SubTopic.SubTopicId, typeof(int), null, ParameterDirection.Input); parameters[2] = new DataAccessParameter("@UserId", post.User.UserId, typeof(int), null, ParameterDirection.Input); parameters[3] = new DataAccessParameter("@DifficultyLevelId", post.DifficultyLevel.DifficultyLevelId, typeof(int), null, ParameterDirection.Input); parameters[4] = new DataAccessParameter("@Tags", post.Tags, typeof(string), null, ParameterDirection.Input); parameters[5] = new DataAccessParameter("@ContentPost", post.ContentPost, typeof(string), null, ParameterDirection.Input); parameters[6] = new DataAccessParameter("@Title", post.Title, typeof(string), null, ParameterDirection.Input); //Retorno el id del objeto creado y lo asigno al post post.PostId = WikiDBAdapter.ExecuteStoredProcedure("InsertPost", parameters); return(post); }
/// <summary> /// 由子类创建Parameter /// </summary> /// <param name="command"></param> /// <param name="parameter"></param> protected abstract void AddParameter(DbCommand command, DataAccessParameter parameter);