public virtual SalesPrompt UpdateSalesPrompt(SalesPrompt entity)
        {
            if (entity.IsTransient())
            {
                return(entity);
            }
            SalesPrompt other = GetSalesPrompt(entity.SalesPromptId);

            if (entity.Equals(other))
            {
                return(entity);
            }
            string sql = @"Update SalesPrompt set  [SalesPromptGUID]=@SalesPromptGUID
							, [Name]=@Name
							, [ExtensionData]=@ExtensionData
							, [Deleted]=@Deleted
							, [CreatedOn]=@CreatedOn 
							 where SalesPromptID=@SalesPromptID"                            ;

            SqlParameter[] parameterArray = new SqlParameter[] {
                new SqlParameter("@SalesPromptID", entity.SalesPromptId)
                , new SqlParameter("@SalesPromptGUID", entity.SalesPromptGuid)
                , new SqlParameter("@Name", entity.Name)
                , new SqlParameter("@ExtensionData", entity.ExtensionData ?? (object)DBNull.Value)
                , new SqlParameter("@Deleted", entity.Deleted)
                , new SqlParameter("@CreatedOn", entity.CreatedOn)
            };
            SqlHelper.ExecuteNonQuery(this.ConnectionString, CommandType.Text, sql, parameterArray);
            return(GetSalesPrompt(entity.SalesPromptId));
        }
        public virtual SalesPrompt InsertSalesPrompt(SalesPrompt entity)
        {
            SalesPrompt other = new SalesPrompt();

            other = entity;
            if (entity.IsTransient())
            {
                string         sql            = @"Insert into SalesPrompt ( [SalesPromptGUID]
				,[Name]
				,[ExtensionData]
				,[Deleted]
				,[CreatedOn] )
				Values
				( @SalesPromptGUID
				, @Name
				, @ExtensionData
				, @Deleted
				, @CreatedOn );
				Select scope_identity()"                ;
                SqlParameter[] parameterArray = new SqlParameter[] {
                    new SqlParameter("@SalesPromptID", entity.SalesPromptId)
                    , new SqlParameter("@SalesPromptGUID", entity.SalesPromptGuid)
                    , new SqlParameter("@Name", entity.Name)
                    , new SqlParameter("@ExtensionData", entity.ExtensionData ?? (object)DBNull.Value)
                    , new SqlParameter("@Deleted", entity.Deleted)
                    , 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(GetSalesPrompt(Convert.ToInt32(identity)));
            }
            return(entity);
        }