public virtual RatingCommentHelpfulness UpdateRatingCommentHelpfulness(RatingCommentHelpfulness entity) { if (entity.IsTransient()) { return(entity); } RatingCommentHelpfulness other = GetRatingCommentHelpfulness(entity.StoreId); if (entity.Equals(other)) { return(entity); } string sql = @"Update RatingCommentHelpfulness set [ProductID]=@ProductID , [RatingCustomerID]=@RatingCustomerID , [VotingCustomerID]=@VotingCustomerID , [Helpful]=@Helpful , [CreatedOn]=@CreatedOn where StoreID=@StoreID" ; SqlParameter[] parameterArray = new SqlParameter[] { new SqlParameter("@StoreID", entity.StoreId) , new SqlParameter("@ProductID", entity.ProductId) , new SqlParameter("@RatingCustomerID", entity.RatingCustomerId) , new SqlParameter("@VotingCustomerID", entity.VotingCustomerId) , new SqlParameter("@Helpful", entity.Helpful) , new SqlParameter("@CreatedOn", entity.CreatedOn) }; SqlHelper.ExecuteNonQuery(this.ConnectionString, CommandType.Text, sql, parameterArray); return(GetRatingCommentHelpfulness(entity.StoreId)); }
public virtual RatingCommentHelpfulness RatingCommentHelpfulnessFromDataRow(DataRow dr) { if (dr == null) { return(null); } RatingCommentHelpfulness entity = new RatingCommentHelpfulness(); entity.StoreId = (System.Int32)dr["StoreID"]; entity.ProductId = (System.Int32)dr["ProductID"]; entity.RatingCustomerId = (System.Int32)dr["RatingCustomerID"]; entity.VotingCustomerId = (System.Int32)dr["VotingCustomerID"]; entity.Helpful = (System.Byte)dr["Helpful"]; entity.CreatedOn = (System.DateTime)dr["CreatedOn"]; return(entity); }
public virtual RatingCommentHelpfulness InsertRatingCommentHelpfulness(RatingCommentHelpfulness entity) { RatingCommentHelpfulness other = new RatingCommentHelpfulness(); other = entity; if (entity.IsTransient()) { string sql = @"Insert into RatingCommentHelpfulness ( [StoreID] ,[ProductID] ,[RatingCustomerID] ,[VotingCustomerID] ,[Helpful] ,[CreatedOn] ) Values ( @StoreID , @ProductID , @RatingCustomerID , @VotingCustomerID , @Helpful , @CreatedOn ); Select scope_identity()" ; SqlParameter[] parameterArray = new SqlParameter[] { new SqlParameter("@StoreID", entity.StoreId) , new SqlParameter("@ProductID", entity.ProductId) , new SqlParameter("@RatingCustomerID", entity.RatingCustomerId) , new SqlParameter("@VotingCustomerID", entity.VotingCustomerId) , new SqlParameter("@Helpful", entity.Helpful) , new SqlParameter("@CreatedOn", entity.CreatedOn) }; var identity = SqlHelper.ExecuteScalar(this.ConnectionString, CommandType.Text, sql, parameterArray); if (identity == DBNull.Value) { throw new DataException("Identity column was null as a result of the insert operation."); } return(GetRatingCommentHelpfulness(Convert.ToInt32(identity))); } return(entity); }
public RatingCommentHelpfulness InsertRatingCommentHelpfulness(RatingCommentHelpfulness entity) { return(_iRatingCommentHelpfulnessRepository.InsertRatingCommentHelpfulness(entity)); }
public RatingCommentHelpfulness UpdateRatingCommentHelpfulness(RatingCommentHelpfulness entity) { return(_iRatingCommentHelpfulnessRepository.UpdateRatingCommentHelpfulness(entity)); }
public virtual RatingCommentHelpfulness DeleteRatingCommentHelpfulness(RatingCommentHelpfulness entity) { this.DeleteRatingCommentHelpfulness(entity.StoreId); return(entity); }