public virtual PollVotingRecord UpdatePollVotingRecord(PollVotingRecord entity)
        {
            if (entity.IsTransient())
            {
                return(entity);
            }
            PollVotingRecord other = GetPollVotingRecord(entity.PollVotingRecordId);

            if (entity.Equals(other))
            {
                return(entity);
            }
            string sql = @"Update PollVotingRecord set  [PollVotingRecordGUID]=@PollVotingRecordGUID
							, [PollID]=@PollID
							, [PollAnswerID]=@PollAnswerID
							, [CustomerID]=@CustomerID
							, [CreatedOn]=@CreatedOn 
							 where PollVotingRecordID=@PollVotingRecordID"                            ;

            SqlParameter[] parameterArray = new SqlParameter[] {
                new SqlParameter("@PollVotingRecordID", entity.PollVotingRecordId)
                , new SqlParameter("@PollVotingRecordGUID", entity.PollVotingRecordGuid)
                , new SqlParameter("@PollID", entity.PollId)
                , new SqlParameter("@PollAnswerID", entity.PollAnswerId)
                , new SqlParameter("@CustomerID", entity.CustomerId)
                , new SqlParameter("@CreatedOn", entity.CreatedOn)
            };
            SqlHelper.ExecuteNonQuery(this.ConnectionString, CommandType.Text, sql, parameterArray);
            return(GetPollVotingRecord(entity.PollVotingRecordId));
        }
        public virtual PollVotingRecord InsertPollVotingRecord(PollVotingRecord entity)
        {
            PollVotingRecord other = new PollVotingRecord();

            other = entity;
            if (entity.IsTransient())
            {
                string         sql            = @"Insert into PollVotingRecord ( [PollVotingRecordGUID]
				,[PollID]
				,[PollAnswerID]
				,[CustomerID]
				,[CreatedOn] )
				Values
				( @PollVotingRecordGUID
				, @PollID
				, @PollAnswerID
				, @CustomerID
				, @CreatedOn );
				Select scope_identity()"                ;
                SqlParameter[] parameterArray = new SqlParameter[] {
                    new SqlParameter("@PollVotingRecordID", entity.PollVotingRecordId)
                    , new SqlParameter("@PollVotingRecordGUID", entity.PollVotingRecordGuid)
                    , new SqlParameter("@PollID", entity.PollId)
                    , new SqlParameter("@PollAnswerID", entity.PollAnswerId)
                    , new SqlParameter("@CustomerID", entity.CustomerId)
                    , 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(GetPollVotingRecord(Convert.ToInt32(identity)));
            }
            return(entity);
        }